private void ForwardLeftRepairingUnits() { foreach (BaseUnit baseUnit in leftUnits) { if (baseUnit.Role == UnitRole.Repair) { TowerTargetingUnit leftUnit = (TowerTargetingUnit)baseUnit; leftUnit.SetDirection(Direction.Left); leftUnit.SetTargetTower(towerManager.GetTowerToDefend(Direction.Left)); } } }
private void ForwardLeftAttackingUnits() { foreach (BaseUnit baseUnit in leftUnits) { if (baseUnit.Role == UnitRole.Attack) { TowerTargetingUnit leftUnit = (TowerTargetingUnit)baseUnit; leftUnit.SetDirection(Direction.Left); leftUnit.SetTargetTower(towerManager.GetTowerToAttack(Direction.Left)); } } }
private async void SpawnDebugUnitsLeft(int quantity) { for (int i = 0; i < quantity; i++) { TowerTargetingUnit towerTargetingUnit = spawnManager.Spawn(debugUnitId).GetComponent <TowerTargetingUnit>(); towerTargetingUnit.SetData(unitDataMap[towerTargetingUnit.UnitId]); towerTargetingUnit.Initialize(); towerTargetingUnit.SetDirection(Direction.Left); towerTargetingUnit.SetTargetTower(towerManager.GetTowerToDefend(Direction.Left)); towerTargetingUnit.GetComponent <UnitGravityBody>().SetReference(transform); leftUnits.Add(towerTargetingUnit); await new WaitForSeconds(0.5f); } }
private void FlipLeftRepairingUnits() { List <BaseUnit> unitsToRemove = new List <BaseUnit>(); foreach (BaseUnit baseUnit in leftUnits) { if (baseUnit.Role == UnitRole.Repair) { TowerTargetingUnit leftUnit = (TowerTargetingUnit)baseUnit; leftUnit.SetDirection(Direction.Right); leftUnit.SetTargetTower(towerManager.GetTowerToDefend(Direction.Right)); unitsToRemove.Add(baseUnit); } } foreach (BaseUnit baseUnit in unitsToRemove) { leftUnits.Remove(baseUnit); rightUnits.Add(baseUnit); } }
private void FlipRightAttackingUnits() { List <BaseUnit> unitsToRemove = new List <BaseUnit>(); foreach (BaseUnit baseUnit in rightUnits) { if (baseUnit.Role == UnitRole.Attack) { TowerTargetingUnit rightUnit = (TowerTargetingUnit)baseUnit; rightUnit.SetDirection(Direction.Left); rightUnit.SetTargetTower(towerManager.GetTowerToAttack(Direction.Left)); unitsToRemove.Add(baseUnit); } } foreach (BaseUnit baseUnit in unitsToRemove) { rightUnits.Remove(baseUnit); leftUnits.Add(baseUnit); } }