예제 #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();
        }
예제 #2
0
        public void StopProductUnit()
        {
            DestroyProductUnitAttachedMesh();

            productUnitType     = null;
            productUnitProgress = 0;

            UpdateAttachedObjectsVisibility();
        }
예제 #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);
        }
예제 #4
0
파일: RTSBuilding.cs 프로젝트: whztt07/SDK
        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();
        }
예제 #5
0
파일: RTSBuilding.cs 프로젝트: whztt07/SDK
        public void StopProductUnit()
        {
            DestroyProductUnitAttachedMesh();

            productUnitType = null;
            productUnitProgress = 0;

            UpdateAttachedObjectsVisibility();
        }