Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ComponentBehaviorSelector.cs
浏览该文件的文档.
3
4namespace Game {
7
8 public List<ComponentBehavior> m_behaviors = [];
9
10 public static bool ShowAIBehavior;
11
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}
override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
ValuesDictionary ValuesDictionary