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(); } } }
private void ExitPurchasingMode() { _currentBuyTransaction.GhostPlatoons.Clear(); _currentBuyTransaction = null; CurMouseMode = MouseMode.normal; }
/** * 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; }
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); }
/** * 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; }