示例#1
0
 void RemoveAllEntities()
 {
     if (core) {
         Destroy (core.gameObject);
         core = null;
     }
     for (int i = 0; i < nodes.Count; i++) {
         Destroy (nodes [i].gameObject);
     }
     nodes.Clear ();
     for (int i = 0; i < policeCars.Count; i++) {
         Destroy (policeCars [i].gameObject);
     }
     policeCars.Clear ();
     //for (int i = 0; i < policeStations.Count; i++)
     //{
     //    Destroy(policeStations[i].gameObject);
     //}
     //policeStations.Clear();
     for (int i = 0; i < humans.Count; i++) {
         Destroy (humans [i].gameObject);
     }
     humans.Clear ();
 }
示例#2
0
 public void Unregister(Entity e)
 {
     FungusNode fn = e as FungusNode;
     if (fn) {
         nodes.Remove (fn);
         CleanupAfterNodes ();
         return;
     }
     Human en = e as Human;
     if (en) {
         humans.Remove (en);
         return;
     }
     PoliceCar pc = e as PoliceCar;
     if (pc) {
         policeCars.Remove (pc);
         return;
     }
     FungusCore fc = e as FungusCore;
     if (fc) {
         if (core == fc) {
             core = null;
         }
         return;
     }
     PoliceStation ps = e as PoliceStation;
     if (ps) {
         policeStations.Remove (ps);
     }
 }
示例#3
0
 public void OnCoreWasKilled(FungusCore core)
 {
     Debug.Log ("Core killed");
     eventDispatcher.FireEvent (LevelEventType.Death);
     #if UNITY_EDITOR
     UnityEditor.EditorApplication.isPaused = true;
     #endif
 }
示例#4
0
 public void Register(Entity e)
 {
     FungusNode fn = e as FungusNode;
     if (fn) {
         if (!nodes.Contains (fn)) {
             nodes.Add (fn);
             fn.transform.parent = entityHolder;
             if (triggerCollection) {
                 triggerCollection.EvaluateForNode (fn.transform.position);
             }
         }
         return;
     }
     Human en = e as Human;
     if (en) {
         if (!humans.Contains (en)) {
             humans.Add (en);
             en.transform.parent = entityHolder;
         }
         return;
     }
     PoliceCar pc = e as PoliceCar;
     if (pc) {
         if (!policeCars.Contains (pc)) {
             policeCars.Add (pc);
             pc.transform.parent = entityHolder;
         }
     }
     FungusCore fc = e as FungusCore;
     if (fc) {
         if (core != null) {
             if (core == fc) {
                 return;
             }
             Debug.LogError ("Multiple cores in Level!");
     #if UNITY_EDITOR
             UnityEditor.EditorApplication.isPaused = true;
     #endif
         } else {
             core = fc;
             fc.transform.parent = entityHolder;
         }
     }
     PoliceStation ps = e as PoliceStation;
     if (ps) {
         if (!policeStations.Contains (ps)) {
             policeStations.Add (ps);
         }
     }
 }
示例#5
0
 public void OnCoreLostGrounding(FungusCore core)
 {
     if (!deathEventCalled) {
         if (OnCoreKilled != null) {
             OnCoreKilled (core);
         }
         Debug.Log ("Core ungrounded");
         eventDispatcher.FireEvent (LevelEventType.Death);
         deathEventCalled = true;
     }
     #if UNITY_EDITOR
     //        UnityEditor.EditorApplication.isPaused = true;
     #endif
 }