public void AddUnit(IWarship ship) { if (ship != null) { _filled = true; } _ship = ship; changing = true; }
private void AddAvailableShip(IWarship ship, int count) { if (ArrAvailableShips.ContainsKey(ship)) { ArrAvailableShips[ship] += count; } else { ArrAvailableShips.Add(ship, count); } }
private void BackToPrevState(IWarship removedSip) { var childs = ContentScrollView.transform.OfType <Transform>().ToList(); foreach (var cell in childs) { var FU = cell.GetComponent <FormationUnits>(); if (FU.Ship == removedSip) { FU.gameObject.SetActive(true); FU.ChangeCount(FU.Count + 1); } } }
public void Init(IWarship ship) { IsDead = false; _moveDistance = ship.StandartDistance; _hitPoints = ship.HitPoint; _shieldPoints = ship.ShieldPoint; _weaponType = ship.WeaponType; _shieldType = ship.ShieldType; _shootingRange = ship.ShootingRange; _damage = ship.Damage; }
private void SubAvailableShip(IWarship ship, int count) { if (ArrAvailableShips.ContainsKey(ship)) { if (ArrAvailableShips[ship] - count > 0) { ArrAvailableShips[ship] -= count; } else { ArrAvailableShips.Remove(ship); } } else { //TODO: throw exeption } }
public void AddToGroup(GameObject ReleasedButton) { if (_playerGroup.Count < MaxSquadSize) { var FU = ReleasedButton.GetComponentInChildren <FormationUnits>(); IWarship AddedShip = FU.Ship; _playerGroup.Add(AddedShip); FU.ChangeCount(FU.Count - 1); SubAvailableShip(FU.Ship, 1); if (FU.Count <= 0) { ReleasedButton.SetActive(false); } var freeCell = GetFreeAvailableSquadCells(); freeCell.AddUnit(AddedShip); } else { //TODO throw exception; } }
public void RemoveUnit(out IWarship removedShip) { removedShip = _ship; RemoveUnit(); }
public void RemoveUnit() { _filled = false; _ship = null; changing = true; }
public void SetUnit(IWarship ship, int count) { _ship = ship; _count = count; }