Example #1
0
 void OnBuildingCreated(IGameEntity entity)
 {
     if (entity.info.isResource)
     {
         OwnResources.Add((Resource)entity);
     }
     else
     {
         OwnBarracks.Add((Barrack)entity);
     }
 }
Example #2
0
        public override void removeEntity(IGameEntity entity)
        {
            if (entity.info.isBuilding)
            {
                if (entity.info.isResource)
                {
                    OwnResources.Remove((Resource)entity);
                }
                else
                {
                    if (((BuildingInfo)entity.info).type == BuildingTypes.STRONGHOLD)
                    {
                        hasStronghold = false;
                    }
                    OwnBarracks.Remove((Barrack)entity);
                }
            }
            else
            {
                Unit u = (Unit)entity;

                if (entity.info.isArmy)
                {
                    if (Army.Contains(u))
                    {
                        Army.Remove(u);
                    }
                }
                else
                {
                    if (Workers.Contains(u))
                    {
                        Workers.Remove(u);
                    }
                }
            }
        }