//Timer to spawn ship. Calls itself every 20 seconds IEnumerator SpawnShip() { yield return(new WaitForSeconds(20f)); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 1, hangarSpawn); StartCoroutine(SpawnShip()); }
// Update is called once per frame void Update() { if (UnitTracker.GetActiveEnemyCount() == 0) { if (bossSpawned == false) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyBattleship, 1, enemySpawns[3]); bossSpawned = true; } else { GameController.Instance.PlayerVictorious(); } } if (UnitTracker.GetActiveEnemyCount() < 20 && enemiesKilled < 20) { int randomSpawn = Random.Range(0, 2); int tempEnemiesKilled = 20 - UnitTracker.GetActiveEnemyCount(); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, tempEnemiesKilled, enemySpawns[randomSpawn]); enemiesKilled += tempEnemiesKilled; } if (UnitTracker.GetActiveAllyCount() < 10 && alliesKilled < 15) { int randomSpawn = Random.Range(0, 2); int temAllyKilled = 10 - UnitTracker.GetActiveAllyCount(); UnitSpawner.SpawnUnitsInArea(UnitReferences.AlliedFighter1, temAllyKilled, allySpawns[randomSpawn]); alliesKilled += temAllyKilled; } }
protected override void PlayerEnteredBoundary(GameObject boundary) { if (boundary == boundaries[0]) { HUDController.Instance.DisplayMessage("We were worried you were leaving us to die", 2.0f); } else if (boundary == boundaries[1]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[0]); priority.addToEnemyPool(UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[1])); } else if (boundary == boundaries[2]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[2]); priority.addToEnemyPool(UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[3])); } else if (boundary == boundaries[3]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[5]); priority.addToEnemyPool(UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[4])); } else if (boundary == boundaries[4]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[6]); priority.addToEnemyPool(UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[7])); } else if (boundary == boundaries[5]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 15, enemySpawns[8]); priority.addToEnemyPool(UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 15, enemySpawns[9])); } }
// Use this for initialization void Start() { if (Time.timeScale != 1) { Time.timeScale = 1; } UnitSpawner.SpawnUnitsInArea(UnitReferences.PlayerFighter1, 1, playerSpawn); }
// Use this for initialization void Start() { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 5, enemySpawns[0]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[1]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 5, enemySpawns[2]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyCruiserLight1, 1, enemySpawns[0]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyCruiserLight1, 1, enemySpawns[1]); UnitSpawner.SpawnUnitsInArea(UnitReferences.AlliedFighter1, 5, allySpawns[0]); UnitSpawner.SpawnUnitsInArea(UnitReferences.AlliedFighter1, 5, allySpawns[1]); }
IEnumerator SpawnShips1() { for (int i = 0; i < 6; i++) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 3, spawn1); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 3, spawn2); yield return(new WaitForSeconds(10)); } AdvanceLevelProgression(); }
protected override void PlayerEnteredBoundary(GameObject boundary) { if (boundary == boundaries[0]) { HUDController.Instance.DisplayMessage("Fly Low!", 2.0f); } else if (boundary == boundaries[1]) { GameController.Instance.PlayerVictorious(); } else if (boundary == boundaries[2]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 5, enemySpawns[0]); UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 25, enemySpawns[8]); } else if (boundary == boundaries[3]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 3, enemySpawns[1]); } else if (boundary == boundaries[4]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[2]); } else if (boundary == boundaries[5]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 8, enemySpawns[3]); UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 8, enemySpawns[10]); } else if (boundary == boundaries[6]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[4]); } else if (boundary == boundaries[7]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 8, enemySpawns[5]); UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 10, enemySpawns[13]); } else if (boundary == boundaries[8]) { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 15, enemySpawns[6]); UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 35, enemySpawns[14]); } else if (boundary == boundaries[9]) { UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 25, enemySpawns[9]); } else if (boundary == boundaries[10]) { UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 50, enemySpawns[11]); UnitSpawner.SpawnUnitsInAreaAndFall(UnitReferences.LaserTurret, 50, enemySpawns[12]); } }
// Use this for initialization void Start() { PoolController.Instance.SetInitialPoolSize(ProjectileReferences.SmallLaser, 400); PoolController.Instance.SetInitialPoolSize(ProjectileReferences.LargeLaser, 5); PoolController.Instance.SetInitialPoolSize(ProjectileReferences.GuidedMissile, 5); PoolController.Instance.Initialize(); UnitSpawner.SpawnUnit(UnitReferences.EnemyCruiserLight1, new Vector3(-100, 50, 100)); UnitSpawner.SpawnUnit(UnitReferences.EnemyCruiserLight1, new Vector3(0, 50, 100)); UnitSpawner.SpawnUnit(UnitReferences.EnemyCruiserLight1, new Vector3(100, 50, 100)); UnitSpawner.SpawnUnit(UnitReferences.AlliedCruiserHeavy1, new Vector3(0, 50, -200), Quaternion.Euler(0, 0, 0)); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 75, enemySpawns[0]); UnitSpawner.SpawnUnitsInArea(UnitReferences.AlliedFighter1, 15, allySpawns[0]); }
void SpawnEnemyShips() { UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[0]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[1]); UnitSpawner.SpawnUnitsInArea(UnitReferences.EnemyFighter1, 10, enemySpawns[2]); }
void SpawnAlliedShips() { UnitSpawner.SpawnUnitsInArea(UnitReferences.AlliedFighter1, 3, allySpawns[0]); }