Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ComponentBehaviorSelector.cs
浏览该文件的文档.
1
using
GameEntitySystem
;
2
using
TemplatesDatabase
;
3
4
namespace
Game
{
5
public
class
ComponentBehaviorSelector
:
Component
,
IUpdateable
{
6
public
ComponentCreature
m_componentCreature
;
7
8
public
List<ComponentBehavior>
m_behaviors
= [];
9
10
public
static
bool
ShowAIBehavior
;
11
12
public
UpdateOrder
UpdateOrder
=>
UpdateOrder
.Default;
13
14
public
virtual
void
Update
(
float
dt) {
15
ComponentBehavior
componentBehavior =
null
;
16
if
(
m_componentCreature
.ComponentHealth.Health > 0f
17
&& !
m_componentCreature
.ComponentBody.IsEmbeddedInIce) {
18
float
num = 0f;
19
foreach
(
ComponentBehavior
behavior
in
m_behaviors
) {
20
float
importanceLevel = behavior.
ImportanceLevel
;
21
if
(importanceLevel > num) {
22
num = importanceLevel;
23
componentBehavior = behavior;
24
}
25
}
26
}
27
foreach
(
ComponentBehavior
behavior2
in
m_behaviors
) {
28
if
(behavior2 == componentBehavior) {
29
if
(!behavior2.
IsActive
) {
30
behavior2.IsActive =
true
;
31
}
32
}
33
else
if
(behavior2.
IsActive
) {
34
behavior2.IsActive =
false
;
35
}
36
}
37
}
38
39
public
override
void
Load
(
ValuesDictionary
valuesDictionary,
IdToEntityMap
idToEntityMap) {
40
m_componentCreature
=
Entity
.FindComponent<
ComponentCreature
>(
true
);
41
foreach
(
ComponentBehavior
item
in
Entity
.FindComponents<
ComponentBehavior
>()) {
42
m_behaviors
.Add(item);
43
}
44
}
45
}
46
}
Game.ComponentBehavior
定义
ComponentBehavior.cs:4
Game.ComponentBehavior.ImportanceLevel
float ImportanceLevel
定义
ComponentBehavior.cs:5
Game.ComponentBehavior.IsActive
virtual bool IsActive
定义
ComponentBehavior.cs:7
Game.ComponentBehaviorSelector
定义
ComponentBehaviorSelector.cs:5
Game.ComponentBehaviorSelector.Update
virtual void Update(float dt)
定义
ComponentBehaviorSelector.cs:14
Game.ComponentBehaviorSelector.m_componentCreature
ComponentCreature m_componentCreature
定义
ComponentBehaviorSelector.cs:6
Game.ComponentBehaviorSelector.Load
override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
定义
ComponentBehaviorSelector.cs:39
Game.ComponentBehaviorSelector.m_behaviors
List< ComponentBehavior > m_behaviors
定义
ComponentBehaviorSelector.cs:8
Game.ComponentBehaviorSelector.ShowAIBehavior
static bool ShowAIBehavior
定义
ComponentBehaviorSelector.cs:10
Game.ComponentBehaviorSelector.UpdateOrder
UpdateOrder UpdateOrder
定义
ComponentBehaviorSelector.cs:12
Game.ComponentCreature
定义
ComponentCreature.cs:7
GameEntitySystem.Component
定义
Component.cs:7
GameEntitySystem.Component.ValuesDictionary
ValuesDictionary ValuesDictionary
定义
Component.cs:12
GameEntitySystem.Component.Entity
Entity Entity
定义
Component.cs:14
GameEntitySystem.IdToEntityMap
定义
IdToEntityMap.cs:5
Game.IUpdateable
定义
IUpdateable.cs:2
GameEntitySystem
定义
Component.cs:6
Game
定义
ContentFileBridge.cs:4
TemplatesDatabase
定义
Database.cs:6
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Component
ComponentBehaviorSelector.cs
制作者
1.16.1