public void StartProductUnit(RTSUnitType unitType) { StopProductUnit(); //check cost RTSFactionManager.FactionItem factionItem = RTSFactionManager.Instance. GetFactionItemByType(Intellect.Faction); if (factionItem != null) { float cost = unitType.BuildCost; if (factionItem.Money - cost < 0) { return; } factionItem.Money -= cost; } productUnitType = unitType; productUnitProgress = 0; CreateProductUnitAttachedMesh(); UpdateAttachedObjectsVisibility(); }
public void StopProductUnit() { DestroyProductUnitAttachedMesh(); productUnitType = null; productUnitProgress = 0; UpdateAttachedObjectsVisibility(); }
public override List <RTSUnitAI.UserControlPanelTask> GetControlPanelTasks() { List <UserControlPanelTask> list = new List <UserControlPanelTask>(); if (ControlledObject.BuildedProgress == 1) { if (ControlledObject.BuildUnitType == null) { //RTSHeadquaters specific if (ControlledObject.Type.Name == "RTSHeadquaters") { RTSUnitType unitType = (RTSUnitType)EntityTypes.Instance.GetByName("RTSConstructor"); list.Add(new UserControlPanelTask(new Task(Task.Types.ProductUnit, unitType), CurrentTask.Type == Task.Types.ProductUnit)); } //RTSFactory specific if (ControlledObject.Type.Name == "RTSFactory") { RTSUnitType unitType = (RTSUnitType)EntityTypes.Instance.GetByName("RTSRobot"); list.Add(new UserControlPanelTask(new Task(Task.Types.ProductUnit, unitType), CurrentTask.Type == Task.Types.ProductUnit)); } } else { list.Add(new UserControlPanelTask(new Task(Task.Types.Stop), CurrentTask.Type == Task.Types.Stop)); } } else { //building list.Add(new UserControlPanelTask(new Task(Task.Types.SelfDestroy))); } return(list); }
public void StartProductUnit( RTSUnitType unitType ) { StopProductUnit(); //check cost RTSFactionManager.FactionItem factionItem = RTSFactionManager.Instance. GetFactionItemByType( Intellect.Faction ); if( factionItem != null ) { float cost = unitType.BuildCost; if( factionItem.Money - cost < 0 ) return; factionItem.Money -= cost; } productUnitType = unitType; productUnitProgress = 0; CreateProductUnitAttachedMesh(); UpdateAttachedObjectsVisibility(); }