コード例 #1
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 bool CallActions(HookEventInfo info)
 {
     for (var i = EventActions.Count; i-->0;)
     {
         if (EventActions[i].Event != info.type) continue;
         if (EventActions[i].NeedsTag & EventActions[i].RequiredTag.Equals(info.tag, StringComparison.OrdinalIgnoreCase)) continue;
         EventActions[i].CachedEventInfo = info;
         EventActions[i].OnInitialize(this, Time.realtimeSinceStartup);
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 void OnResourceGained()
 {
     if (EventActions.Count == 0) return;
     var he = new HookEventInfo() { type = TutorialEventType.ResourceGained };
     if (CallActions(he))
     {
         FungusResources.OnResourceGain -= OnResourceGained;
     }
 }
コード例 #3
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 void OnSpawnerSpawned(Entity e, EntitySpawner spawner, string tutorialtag)
 {
     if (EventActions.Count == 0) return;
     var he = new HookEventInfo() {LinkedEntity = e, LinkedSpawner = spawner, tag = tutorialtag, type = TutorialEventType.SpawnerSpawned};
     if (CallActions(he))
     {
         EntitySpawner.OnSpawn -= OnSpawnerSpawned;
     }
 }
コード例 #4
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 bool OnPoliceAlarmed(Entity e)
 {
     if (EventActions.Count == 0) return false;
     var he = new HookEventInfo() { LinkedEntity = e, type = TutorialEventType.PoliceAlarmed };
     return CallActions(he);
 }
コード例 #5
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 void OnNodeDestroyed(Entity e)
 {
     if (EventActions.Count == 0) return;
     var he = new HookEventInfo() { LinkedEntity = e, type = TutorialEventType.NodeDestroyed };
     if (CallActions(he))
     {
         GameWorld.OnNodeDestroyed -= OnNodeDestroyed;
     }
 }
コード例 #6
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 void OnEntityDamaged(Entity e)
 {
     if (EventActions.Count == 0) return;
     if (!(e is Human)) return;
     var he = new HookEventInfo() {LinkedEntity = e, type = TutorialEventType.HumanDamaged};
     if (CallActions(he))
     {
         Entity.OnDamaged -= OnEntityDamaged;
     }
 }
コード例 #7
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 bool OnCitizenPanic(Entity e)
 {
     if (EventActions.Count == 0) return false;
     var he = new HookEventInfo() { LinkedEntity = e, type = TutorialEventType.CitizenPanic };
     return CallActions(he);
 }
コード例 #8
0
ファイル: Tutorial.cs プロジェクト: Nachtrind/Fungus
 void OnAbilityGained(NodeAbility ability)
 {
     if (EventActions.Count == 0) return;
     var he = new HookEventInfo() { LinkedAbility = ability, type = TutorialEventType.AbilityGained };
     if (CallActions(he))
     {
         AbilityBuilding.OnAbilityGained -= OnAbilityGained;
     }
 }