// Cube Spawning void Spawn_Cubes() { for (int i = 0; i < cubes_spawning; i++) { int current_number = Random.Range(0, temp_all_spots.Count); cube_spawning_spots.Add(temp_all_spots[current_number]); temp_all_spots.Remove(temp_all_spots[current_number]); } // Selects Random Ints Within the Cube Spawn List To Spawn Items Under Cubes power_up_int = Random.Range(0, cube_spawning_spots.Count); exit_int = Random.Range(0, cube_spawning_spots.Count); for (int i = 0; i < cube_spawning_spots.Count; i++) { Instantiate(wall_prefab, cube_spawning_spots[i].transform.position, cube_spawning_spots[i].transform.rotation); if (power_up_int == i) { GameObject powerup = Instantiate(power_up_prefab, cube_spawning_spots[i].transform.position, cube_spawning_spots[i].transform.rotation) as GameObject; powerup.GetComponent <Power_Up>().power_up_type = power_up_type; } if (exit_int == i) { GameObject exit_go = Instantiate(exit_prefab, new Vector3(cube_spawning_spots[i].transform.position.x, 0.001f, cube_spawning_spots[i].transform.position.z), cube_spawning_spots[i].transform.rotation) as GameObject; exit = exit_go.GetComponent <Level_Exit>(); } } }
// Selects The Bonus For The Stage Dependant On What Data Says It Is Meant To Be public void Select_Bonus(Level_Exit exit, Wall_Spawner w_spawner) { level_exit = GameObject.FindGameObjectWithTag("Exit").GetComponent <Level_Exit>(); wall_spawner = w_spawner; level_number = Data.game_data.level_number; bonus_type = Data.game_data.bonus_types[level_number]; d_walls = wall_spawner.cubes_spawning; }
// Called When The Enemy Dies public void Die() { Level_Exit lvl_exit = GameObject.FindGameObjectWithTag("Exit").GetComponent <Level_Exit>(); lvl_exit.number_of_enemies--; Data.game_data.score += points; Destroy(gameObject); }
IEnumerator Initial_Delay() { yield return(new WaitForSeconds(0.1f)); local_wall_spawner.Delay(); local_data.Delay(); local_bonuses.Select_Bonus(local_level_exit, local_wall_spawner); yield return(new WaitForSeconds(0.1f)); local_level_exit = local_wall_spawner.exit; local_level_exit.Delay(); local_ui.Delay(); yield return(new WaitForSeconds(2.0f)); local_bonuses.started = true; }