Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void StopProductUnit()
        {
            DestroyProductUnitAttachedMesh();

            productUnitType     = null;
            productUnitProgress = 0;

            UpdateAttachedObjectsVisibility();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        public void StopProductUnit()
        {
            DestroyProductUnitAttachedMesh();

            productUnitType = null;
            productUnitProgress = 0;

            UpdateAttachedObjectsVisibility();
        }