Example #1
0
 protected bool CanNowProduceUnit(UnitType unitType)
 {
     return(SupportsUnitProduction.Contains(unitType) &&
            null != BuildingController.unitProduction.TryConstructProduction(
                UnitHelper.FindUnitIndexInUnitProduction(unitType, BuildingController.unitProduction),
                GameManager.Instance.ResourceManagerFaction[BuildingController.FactionIndex],
                BuildingController.PlayerOwner));
 }
Example #2
0
        protected void ProduceUnit(UnitType unitType)
        {
            int unitIndex;

            try
            {
                unitIndex = UnitHelper.FindUnitIndexInUnitProduction(unitType, BuildingController.unitProduction);
            }
            catch (Exception)
            {
                throw new UnitProductionException(string.Format("{0} cannot produce {1} unit", this, unitType));
            }
            var success = BuildingController.unitProduction.StartProduction(
                unitIndex,
                GameManager.Instance.ResourceManagerFaction[BuildingController.FactionIndex],
                BuildingController.PlayerOwner);

            if (!success)
            {
                throw new NotEnoughResourcesException();
            }
            Tutorial.Instance.UnitProduction();
        }