public void QuickClean() //cleans ALL following rooms that have responsible one != null { if (RecursiveQuick) { return; } //was here before? if (responsibleOne == null) { return; } //is there responsible one to overwrite? RecursiveQuick = true; responsibleOne = null; IsVoid = false; VoidIn = VoidTakes + 1; RadiationIn = RadiationTakes + 1; VoidMarker.SetActive(false); //fix room for (int i = 0; i < Doors.Count; i++) { var door = Doors[i].GetComponent <DoorsScript>(); if (door.open) { if (!door.airlock) { var room = door.roomA; if (room == gameObject) { room = door.roomB; } room.GetComponent <RoomScript>().QuickClean(); } } } //expand change }
private void HandleExpousere() { HandleExpousereTimeStep -= Time.deltaTime; if (HandleExpousereTimeStep < 0) { HandleExpousereTimeStep = 1; //sim update env once a sec if (!(VoidTakes < VoidIn)) {//is beign exposed to void for first time VoidIn -= HandleExpousereTimeStep; if (VoidIn <= 0) { VoidIn = VoidTakes + 1; IsVoid = true; VoidMarker.SetActive(true); GameMaster.WriteInConsole.Add("SYS: Room " + gameObject.name + " is now void\n"); } } if (!(RadiationTakes < RadiationIn)) {//is beign exposed to radiation for first time RadiationIn -= HandleExpousereTimeStep; if (RadiationIn <= 0) { RadiationIn = RadiationTakes + 1; IsContaminated = true; RadiationMarker.SetActive(true); GameMaster.WriteInConsole.Add("SYS: Room " + gameObject.name + " is now contaminated\n"); } } //update clocks if needed RecursiveCheckMarker = false; RecursiveQuick = false; //reset values if needed; if ((IsVoid || IsContaminated) && responsibleOne != null) //it there reason to care and is there source? { if (!responsibleOne.open) //is source of this mess closed? { if (RecursiveExpousureCheckCaller(out var room, out var airlock)) { room.QuickExpand(airlock); } else { QuickClean(); responsibleOne = null; } } } //check if hole sealed if (IsVoid || IsContaminated) { Doors.ForEach(door => { var script = door.GetComponent <DoorsScript>(); if (!script.airlock && script.open) { script.roomA.GetComponent <RoomScript>().Exposed(IsVoid, IsContaminated, script); script.roomB.GetComponent <RoomScript>().Exposed(IsVoid, IsContaminated, script); } }); } //expand if posible (after check so that noting weird can happen if was source) } }