Esempio n. 1
0
 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));
         }
     }
 }
Esempio n. 2
0
 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));
         }
     }
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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);
            }
        }