示例#1
0
        private void AddBuilding(AbstractBuilding building)
        {
            Buildings.Add(building);
            Buildables.Add(building.Id, building);

            foreach (var capability in building.BuildCapabilities)
            {
                if (!BuildCapabilities.ContainsKey(capability.Key))
                {
                    BuildCapabilities.Add(capability.Key, capability.Value);
                }
            }

            foreach (var capability in building.TrainCapabilities)
            {
                if (!TrainCapabilities.ContainsKey(capability.Key))
                {
                    TrainCapabilities.Add(capability.Key, capability.Value);
                }
            }

            building.UnderConstructionEvent += Building_UnderConstructionEvent;
            building.StartBuilding();
        }
示例#2
0
 private void AddUnit(AbstractUnit unit)
 {
     Units.Add(unit);
     Buildables.Add(unit.Id, unit);
 }