Beispiel #1
0
 private void unregisterEntityEvents(IGameEntity entity)
 {
     if (entity.info.isBarrack)
     {
         Barrack barrack = (Barrack)entity;
         barrack.unregister(Barrack.Actions.DAMAGED, events.DisplayUnderAttack);
         barrack.unregister(Barrack.Actions.DESTROYED, events.DisplayBuildingDestroyed);
         barrack.unregister(Barrack.Actions.CREATE_UNIT, OnUnitCreated);
         barrack.unregister(Barrack.Actions.BUILDING_FINISHED, events.DisplayBuildingCreated);
     }
     else if (entity.info.isResource)
     {
         Resource resourcesBuilding = (Resource)entity;
         resourcesBuilding.unregister(Resource.Actions.DAMAGED, events.DisplayUnderAttack);
         resourcesBuilding.unregister(Resource.Actions.DESTROYED, events.DisplayBuildingDestroyed);
         resourcesBuilding.unregister(Resource.Actions.BUILDING_FINISHED, events.DisplayBuildingCreated);
         resourcesBuilding.unregister(Resource.Actions.CREATE_UNIT, OnUnitCreated);
     }
     else if (entity.info.isUnit)
     {
         Unit unit = (Unit)entity;
         unit.unregister(Unit.Actions.DIED, events.DisplayUnitDead);
         unit.unregister(Unit.Actions.DAMAGED, events.DisplayUnderAttack);
         unit.unregister(Unit.Actions.TARGET_TERMINATED, signalMissionUpdate);
         unit.unregister(Unit.Actions.EAT, onUnitEats);
     }
 }
Beispiel #2
0
 public void unregisterBuildingToEvents(IGameEntity entity)
 {
     if (entity.info.isResource)
     {
         Resource resource = (Resource)entity;
         resource.unregister(Resource.Actions.NEW_HARVEST, OnNewHarvest);
         resource.unregister(Resource.Actions.NEW_EXPLORER, OnNewExplorer);
         resource.unregister(Resource.Actions.COLLECTION, OnCollection);
         resource.unregister(Resource.Actions.CREATED, OnCreated);
         resource.unregister(Resource.Actions.EXTERMINATED, OnDestroyed);
     }
     else if (entity.info.isBarrack)
     {
         Barrack barrack = (Barrack)entity;
         barrack.unregister(Barrack.Actions.CREATED, OnCreated);
     }
 }