IEnumerator DiePretty(float delay) { if (death_effect.Equals("")) { death_effect = "Toys/toy_death_puffy_pale_blue"; } if (death_effect_object == null) { death_effect_object = Peripheral.Instance.zoo.getObject(death_effect, false); death_effect_object.transform.position = this.transform.position; } death_effect_object.transform.position = this.transform.position; death_effect_object.SetActive(true); yield return(new WaitForSeconds(.5f)); StopAllCoroutines(); if (toy_type == ToyType.Temporary) { island.MakeDeadIsland(-1); } if (runetype == RuneType.SensibleCity) { Peripheral.Instance.addedCity(false, this); } Peripheral.Instance.zoo.returnObject(this.gameObject); //Peripheral.Instance.zoo.returnObject (island.parent, true); }
public void LoadBasicMidLevelShit(SaveState saver) { // Debug.Log("Peripheral loaded snapshot, wave " + saver.current_wave + "\n"); StopAllCoroutines(); level_state = LState.WaveButton; ChangeTime(TimeScale.Normal); Wave_interval = 0f; TIME = 0f; have_cities = false; toy_parents = new List <Toy>(); Moon.Instance.WaveInProgress = false; foreach (unitStatsSaver a in saver.actor_stats) { Central.Instance.setUnitStats(a, a.toy_id.toy_type == ToyType.Hero); } Monitor.Instance.ResetIslands(); xp_factor.Reset(); damage_factor.Reset(); dream_factor.Reset(); difficulty = saver.difficulty; if (saver.type == SaveStateType.MidLevel) { FancyLoader.Instance.LoadWavesOnly(Central.Instance.level_list.levels[Central.Instance.current_lvl].name); Moon.Instance.SetWave(saver.current_wave, 0); Sun.Instance.Init(0); Moon.Instance.WaveInProgress = false; foreach (unitStatsSaver a in saver.actor_stats) { Central.Instance.setUnitStats(a, true); } TIME = next_wave_time; Debug.Log("Peripheral Loading snapshot\n"); // Sun.Instance.SetTimePassively(saver.time_of_day); PlaceCastle(); RuneSaver castle_toysaver = saver.getCastle(); if (castle_toysaver != null) { castle.loadSnapshot(castle_toysaver); //this guy needs to be loaded first } else { Debug.LogError("Could not find castle toysaver!"); } //castle.rune.DoSpecialThing(EffectType.Architect); //load gnomesss if (saver.health > 0) { SetHealth(saver.health, false); } dreams = saver.dreams; setToys(0); monster_count = 0; for (int i = 0; i < saver.islands.Count; i++) { var island_saver = saver.islands[i]; Island_Button island = null; Monitor.Instance.islands.TryGetValue(island_saver.name, out island); if (island == null) { Debug.Log("Could not find island " + island_saver.name + "\n"); continue; } if (island_saver.island_type != IslandType.Null) { island.ChangeType(island_saver.island_type, false); } if (island_saver.toy_saver != null) { if (island_saver.toy_saver.rune_saver.runetype == RuneType.Castle) { continue; } if (island_saver.toy_saver.toy_name.Equals(Get.NullToyName())) { continue; } Toy toy = null; GameObject toy_object = makeToy(island_saver.toy_saver.toy_name, island, false, ref toy, false); if (toy_object == null) { Debug.Log("FAILED TO LOAD TOY! NO FIREARM\n"); return; } toy.loadSnapshot(island_saver.toy_saver); if (toy.firearm != null) { toy.firearm.CheckForUpgrades(); } if (island_saver.toy_saver.rune_saver.runetype != RuneType.Modulator && (island_saver.toy_saver.type == ToyType.Normal)) { incrementToys(); } } if (!(island_saver.block_timer > 0)) { continue; } island.MakeDeadIsland(island_saver.block_timer); } //skillmaster is initialized indirectly, when the toys are initialized, through Rune Central.Instance.level_list.special_skill_button_driver.Init(); EagleEyes.Instance.UpdateToyButtons("blah", ToyType.Normal, false); } else { Debug.LogError("Loading midlevel shit on a non midlevel savegame!\n"); Debug.Log("Peripheral loaded start level snapshot, current wave is " + 0 + "\n"); Moon.Instance.SetWave(0, 0); Sun.Instance.Init(0); PlaceCastle(); }// end loading snapshot specific stuff EagleEyes.Instance.UpdateToyButtons("blah", ToyType.Normal, false); level_active = true; ChangeTime(TimeScale.Normal); // not sure what this is for, what are we saving for castle??? //if (saver.castle != null){ castle.loadSnapshot(saver.castle); } }