private void HandlePass() { var ovenSettings = (OvenSetting)(this.currentSymbol + 1); Debug.LogFormat("[Cooking #{0}] Submitted:", this._moduleId); Debug.LogFormat("[Cooking #{0}] - Temp {1} C", this._moduleId, this.temp); Debug.LogFormat("[Cooking #{0}] - Time {1} min", this._moduleId, this.time); Debug.LogFormat("[Cooking #{0}] - Setting: {1}", this._moduleId, CookingHelper.GetOvenSettingName(ovenSettings)); Debug.LogFormat("[Cooking #{0}] - Lamp {1}", this._moduleId, this.ovenStartSymbol == 1); if (this.cookingHelper.Passed(temp, time, ovenStartSymbol == 1, ovenSettings)) { Debug.LogFormat("[Cooking #{0}] Correct! Module passed.", this._moduleId); Audio.PlaySoundAtTransform("ModuleSolved", this.Module.transform); Module.HandlePass(); this.isSolved = true; } else { Debug.LogFormat("[Cooking #{0}] Wrong answer! Strike.", this._moduleId); Module.HandleStrike(); this.isSolved = false; } }
void Activate() { currentSymbol = UnityEngine.Random.Range(0, 6); Symbol.material.mainTexture = TypeSymbols[currentSymbol]; ovenStartSymbol = 0; temp = 0; time = 0; cookingHelper = new CookingHelper(_moduleId, Info); cookingHelper.LogSolution(); TypeBtns[0].OnInteract += delegate { TypeBtns[0].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.TypeBtns[0].transform); if (this.isSolved) { return(false); } currentSymbol = (currentSymbol - 1 < 0) ? 5 : currentSymbol - 1; Symbol.material.mainTexture = TypeSymbols[currentSymbol]; return(false); }; TypeBtns[1].OnInteract += delegate { TypeBtns[1].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.TypeBtns[1].transform); if (this.isSolved) { return(false); } currentSymbol = (currentSymbol + 1 > 5) ? 0 : currentSymbol + 1; Symbol.material.mainTexture = TypeSymbols[currentSymbol]; return(false); }; LightBtn.OnInteract += delegate { LightBtn.AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.LightBtn.transform); if (this.isSolved) { return(false); } if (ovenStartSymbol == 0) { OvenDoor.material.mainTexture = OvenDoorSates[1]; ovenStartSymbol = 1; return(false); } else { OvenDoor.material.mainTexture = OvenDoorSates[0]; ovenStartSymbol = 0; return(false); } }; DegreeBtns[0].OnInteract += delegate { DegreeBtns[0].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.DegreeBtns[0].transform); if (this.isSolved) { return(false); } if (temp > 0) { this.temp -= 10; this.DegreeTxt.text = temp.ToString(); } return(false); }; DegreeBtns[1].OnInteract += delegate { DegreeBtns[1].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.DegreeBtns[1].transform); if (this.isSolved) { return(false); } if (temp < 250) { this.temp += 10; this.DegreeTxt.text = temp.ToString(); } return(false); }; TimeBtns[0].OnInteract += delegate { TimeBtns[0].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.TimeBtns[0].transform); if (this.isSolved) { return(false); } if (time > 0) { this.time -= 5; this.MinutesTxt.text = time.ToString(); } return(false); }; TimeBtns[1].OnInteract += delegate { TimeBtns[1].AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.TimeBtns[1].transform); if (this.isSolved) { return(false); } if (time < 95) { this.time += 5; this.MinutesTxt.text = time.ToString(); } return(false); }; CookBtn.OnInteract += delegate { CookBtn.AddInteractionPunch(); Audio.PlaySoundAtTransform("ButtonSound", this.CookBtn.transform); if (this.isSolved) { return(false); } this.HandlePass(); return(false); }; }