GameEntities.RTSBuilding.StartProductUnit C# (CSharp) Method

StartProductUnit() public method

public StartProductUnit ( RTSUnitType unitType ) : void
unitType RTSUnitType
return void
        public void StartProductUnit( RTSUnitType unitType )
        {
            StopProductUnit();

            //check cost
            RTSFactionManager.FactionItem factionItem = RTSFactionManager.Instance.
                GetFactionItemByType( Intellect.Faction );
            // Reduce the factions money by the unit's cost
            if( factionItem != null )
            {
                float cost = unitType.BuildCost;

                if( factionItem.Money - cost < 0 )
                    return;

                factionItem.Money -= cost;
            }

            productUnitType = unitType;
            productUnitProgress = 0;

            CreateProductUnitAttachedMesh();

            UpdateAttachedObjectsVisibility();
        }