public void StartWashCycle() { if (!StartButtonLocked && state == WashingMachineState.DoorClosed) { state = WashingMachineState.Running; StartCoroutine(WashCycle()); } }
protected override void Start() { areaPrefab = (GameObject)Resources.Load("WashingMachineArea"); HasGravity = true; base.Start(); contents = new List <Garment>(); state = WashingMachineState.DoorClosed; washSetting = WashSetting.Cold; }
public void ToggleDoor() { if (!DoorLocked && (state == WashingMachineState.DoorClosed || state == WashingMachineState.Done)) { state = WashingMachineState.DoorOpen; DoorOpens(); } else if (!DoorLocked && (state == WashingMachineState.DoorOpen)) { state = WashingMachineState.DoorClosed; DoorCloses(); } }
private IEnumerator WashCycle() { bool containsColoredGarments = false; AudioManager.instance.PlaySound(SoundName.MachineStart); List <Garment> garmentsToBeAdded = new List <Garment>(); foreach (Garment garment in contents) { //Unfold garments if they are folded if (garment is GarmentSock && garment.Folded) { GarmentSock other = ((GarmentSock)garment).SeparatePair(); other.currentFoldingStep = 0; other.Dry = false; garmentsToBeAdded.Add(other); } garment.currentFoldingStep = 0; garment.Dry = false; if (garment.Colored()) { containsColoredGarments = true; } } //Put separated socks in machine foreach (Garment garment in garmentsToBeAdded) { contents.Add(garment); } if (autoCompleteFlag) { AudioManager.instance.PlaySoundLoop(SoundName.RunningWM, 6.0f); yield return(new WaitForLaundromatSeconds(6.0f)); autoCompleteFlag = false; } else { AudioManager.instance.PlaySoundLoop(SoundName.RunningWM, WashCycleTime); yield return(new WaitForLaundromatSeconds(WashCycleTime)); } foreach (Garment garment in contents) { if (!garment.Colored() && washSetting == WashSetting.Hot && containsColoredGarments) { garment.color = GarmentColor.Pink; garment.Dyed = true; } if (garment.fabric.washingRestrictions == WashingRestrictions.HandWashOnly) { garment.Torn = true; } if (garment.fabric.washingRestrictions == WashingRestrictions.ColdOnly && washSetting == WashSetting.Hot) { garment.Melted = true; } if (garment.fabric.washingRestrictions == WashingRestrictions.HotOnly && washSetting == WashSetting.Cold) { garment.Shrunk = true; } if (Detergent) { garment.Clean = true; if (garment.fabric.washingRestrictions == WashingRestrictions.NoDetergent) { garment.Dyed = true; } } else if (!Detergent) { if (garment.fabric.washingRestrictions == WashingRestrictions.NoDetergent) { garment.Clean = true; } } } Detergent = false; state = WashingMachineState.Done; }
public WashingMachine() { _wmState = new TurnOnState(); }