示例#1
0
        private void MaybePurchaseGhostUnits(SpawnPointBehaviour closestSpawn)
        {
            if (Input.GetMouseButtonUp(0))
            {
                bool noUIcontrolsInUse = EventSystem.current.currentSelectedGameObject == null;

                if (!noUIcontrolsInUse)
                {
                    return;
                }

                if (_currentBuyTransaction == null)
                {
                    return;
                }

                closestSpawn.BuyPlatoons(_currentBuyTransaction.GhostPlatoons);

                if (Input.GetKey(KeyCode.LeftShift))
                {
                    // We turned the current ghosts into real units, so:
                    _currentBuyTransaction = _currentBuyTransaction.Clone();
                }
                else
                {
                    ExitPurchasingMode();
                }
            }
        }
示例#2
0
        private void ExitPurchasingMode()
        {
            _currentBuyTransaction.GhostPlatoons.Clear();

            _currentBuyTransaction = null;

            CurMouseMode = MouseMode.normal;
        }
示例#3
0
 /**
  * Called when the arty button is pressed in the buy menu.
  */
 public void ArtyButtonCallback()
 {
     if (_currentBuyTransaction == null)
     {
         _currentBuyTransaction = new BuyTransaction(UnitType.Arty, _localPlayer);
     }
     else
     {
         _currentBuyTransaction.AddUnit();
     }
     CurMouseMode = MouseMode.purchasing;
 }
示例#4
0
        public BuyTransaction Clone()
        {
            BuyTransaction clone = new BuyTransaction(UnitType, Owner);

            int unitCount = (GhostPlatoons.Count - 1) * MAX_PLATOON_SIZE + _smallestPlatoonSize;

            while (unitCount-- > 1)
            {
                clone.AddUnit();
            }

            return(clone);
        }
示例#5
0
        /**
         * Called when the tank button is pressed in the buy menu.
         */
        public void TankButtonCallback()
        {
            if (_currentBuyTransaction == null)
            {
                _currentBuyTransaction = new BuyTransaction(UnitType.Tank, _localPlayer);
            }
            else
            {
                _currentBuyTransaction.AddUnit();
            }

            //buildUnit(UnitType.Tank);
            CurMouseMode = MouseMode.purchasing;
        }