// A Delay To Ensure Everything It Needs Is Spawned In public void Delay() { // Gets The Stage Number And Powerup Type For That Stage level_number = Data.game_data.level_number; power_up_type = Data.game_data.powerup_types[level_number]; // Gets The Amount Of Each Enemy Type that Spwans In For The Particular Stage enemy_spawing_numbers[0] = Data.game_data.balloom_spawn_number[level_number]; enemy_spawing_numbers[1] = Data.game_data.oneal_spawn_number[level_number]; enemy_spawing_numbers[2] = Data.game_data.doll_spawn_number[level_number]; enemy_spawing_numbers[3] = Data.game_data.minvo_spawn_number[level_number]; enemy_spawing_numbers[4] = Data.game_data.kondoria_spawn_number[level_number]; enemy_spawing_numbers[5] = Data.game_data.ovapi_spawn_number[level_number]; enemy_spawing_numbers[6] = Data.game_data.pass_spawn_number[level_number]; enemy_spawing_numbers[7] = Data.game_data.pontan_spawn_number[level_number]; // Assigns The Spawn Locations To A Temporary List For Use temp_all_spots = all_spots; // Normal Spawning For Stages if (Data.game_data.bonus_stage == Bonus_Stage.Off) { Spawn_Cubes(); Spawn_Enemies(); } // Spawning For Bonus Stages else { Instantiate(exit_prefab, new Vector3(1000, 0, 0), transform.rotation); StartCoroutine(Bonus_Stage_Spawn_Enemies()); } }
public void addPower(Power_Ups power, float time = 10) { power_timers[(int)power] = time; power_up.gameObject.SetActive(true); power_up.enablePower(power); GetComponent <PlayerUI>().SetBoostUI(power.ToString()); }
/// <summary> /// checks if possible to add an item to cart, adds it and sets image if so. /// </summary> /// <param name="item">Item object to be added</param> /// <returns></returns> public bool AddItem(StoreItem item) { if (item.group == "Power_Up" && heldPU == Power_Ups.Empty) { //Debug.Log("grabbed PU"); heldPU = (Power_Ups)(item.index - 16); if (player_controlled) { Debug.Log(heldPU + "_icon"); PUIcon.sprite = Resources.Load <Sprite>(heldPU + "_icon"); } return(true); } else if (items.Count < maxItems)//checks to see if cart is full { items.Add(item); Debug.Log("item count: " + items.Count); if (items.Count == 1)//needed to adjust the first item to the right spot { if (player_controlled) { CartItem.transform.position = new Vector3(0, 1.6f, -0.05f); } else { CartItem.transform.position = new Vector3(0, 0.6f, -0.05f); } } else if (items.Count == 2)//subsequent items are parented so they can be at 0 { CartItem.transform.position = new Vector3(0, 0, -0.05f); } CartItem.transform.Rotate(Vector3.back * Random.Range(0, 360));//give it a nice spin CartItem.GetComponent <SpriteRenderer>().sprite = item.image; TopItem = Instantiate(CartItem, TopItem.transform); return(true); } return(false);//cart is full, dont update shelf }
/// <summary> /// handles shield and boost initial uses, and redirects for Grabber/Scanner functions /// </summary> public void UsePowerup() { if (heldPU != Power_Ups.Empty) { switch (heldPU) { case Power_Ups.Boost: BoostTimer = BoostDuration; if (player_controlled) { GetComponent <Movement>().temp_speed *= BoostPower; } else { GetComponent <AIPath>().maxSpeed *= BoostPower; } break; case Power_Ups.Shield: ShieldTimer = ShieldDuration; Shielded = true; break; case Power_Ups.Grabber: UseGrabber(); break; case Power_Ups.Scanner: SpawnScanners(); break; } heldPU = Power_Ups.Empty; if (player_controlled) { PUIcon.sprite = Resources.Load <Sprite>("empty_icon"); } } }
public void enablePower(Power_Ups power) { powers_active[(int)power] = true; }
public bool powerActive(Power_Ups power) { return(power_timers[(int)power] > 0); }