/// <summary> /// Set the next state for a side of pancake :). /// </summary> /// <param name="side"> the side of pancake to move onto the next state </param> /// <param name="nextStateId"> the next state id, if >= 0 to manuly set the cooking state else auto (default -1) </param> private void SetNextState(int side, int nextStateId = -1) { if (nextStateId < 0) { nextStateId = currentCookingStates[side].currentCookingStateId + 1; } if (nextStateId >= cookingStates.Length) { return; } CookingState state = cookingStates[nextStateId]; currentCookingStates[side].currentCookingStateId = nextStateId; currentCookingStates[side].currentState = state; //Nedded ? currentCookingStates[side].stateTimer.SetTimer(state.stateLength, true); }
public void SetState(CookingState state) { pancakeState = state.pancakeState; stateLength = state.stateLength; endColor = state.endColor; }
public override bool IsValid(Mom entity) { string[] lines = entity.currentState.text.Split('\n'); string lastLine = lines[lines.Length - 1]; string currentLine = ""; switch (nextState) { case 0: currentLine = "Checking Child"; if (lastLine != currentLine) { entity.currentState.text += "\n" + currentLine; } entity.child.money += entity.money; entity.money = 0; StoreState storeState = new StoreState(); if (storeState.IsValid(entity.child)) { entity.child.currentState.text += "\nReady"; return(true); } break; case 1: currentLine = "Checking Stove"; if (lastLine != currentLine) { entity.currentState.text += "\n" + currentLine; } entity.stove.food = entity.food; CookingState cookingState = new CookingState(); if (cookingState.IsValid(entity.stove)) { entity.stove.currentState.text += "\nReady"; return(true); } break; case 2: currentLine = "Checking Washer"; if (lastLine != currentLine) { entity.currentState.text += "\n" + currentLine; } WashingState washingState = new WashingState(); if (washingState.IsValid(entity.washer)) { entity.washer.currentState.text += "\nReady"; return(true); } break; default: return(true); } return(false); }