/// <summary> /// Hit Add button, so finished slicing /// </summary> /// <param name="g"></param> public void AddSlices(Graspable g) { controlKnob.callOnUpdate = null; controlKnob.clickUpAction = null; if (currrentSliceTarget) { addedItems[currrentSliceTarget.name] = currrentSliceTarget.SliceCount; if (dropInfo) { dropInfo.SetText("Added " + currrentSliceTarget.SliceCount + " slices"); dropInfo.ShowFor(1f); LeanTween.delayedCall(1f, () => { baguetteSlicesPrep.Show(); activeMenu = true; }); } currrentSliceTarget.Show(false); currrentSliceTarget = null; } else if (dropInfo) { dropInfo.Show(false); } controlKnob.Show(false); addSlicesButton.Show(false); activeMenu = false; }
public override void Enter(ActivityBase a, StateProcessor previousState) { base.Enter(a, previousState); ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.Pointing; if (infoPanel) { infoPanel.SetText(string.Format(startPrompt, timeToCompleteActivity)); if (introOnly) { ControllerInput.Instance.PointerMode = ControllerInput.EnPointerMode.None; if (!clickToContinue) { infoPanel.ShowFor(ActivitySettings.Asset.TextDisplayTime(startPrompt), () => { PostExit(true); }); } } } if (continueButton) { continueButton.Activate(continuePrompt, (continueButton) => { ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); }); }); } switch1.NotifyOnSwitch = Switched1; switch1.gameObject.SetActive(false); device1.OnConnectionChanged = OnConnectionChanged; device2.OnConnectionChanged = OnConnectionChanged; circuitState = Circuit.CircuitType.Open; circuit.CallOnTraceComplete = OnTraceComplete; }
private void Finish() { complete = true; string report = ""; int total = correctConnections; if (total == CORRECT_COUNT) { total *= correctConnections; } total -= (incorrectConnections * INCORRECT_MULTIPLIER); if (shortCircuit) { total = 0; report += "Short circuit! "; } if (correctConnections == CORRECT_COUNT && incorrectConnections == 0) { PlayReward(); } Utils.RegisterActivityAndUpdateExperience(total); report += string.Format("Correct connections: {0} out of {1}. Incorrect connections: {2}. Total points: {3}", correctConnections, correctConnectionList.Count, incorrectConnections, ActivitySettings.Asset.currentActivityScore); infoPanel.SetText(report); infoPanel.TryBonus(); infoPanel.ShowFor(ActivitySettings.Asset.titleDisplayTime, () => { PostExit(true); }); }
private void Finish() { int points = 0; int deductions = shortCount * ShortMultiplier; DisableTimer(); string report = ""; if (testComplete) { report += "Testing successfully completed. "; points = ActivitySettings.pointsPerChallenge - deductions; if (shortCount < 3) { if (shortCount == 0) { PlayReward(); report += "Bonus for no short circuits! "; } else { report += string.Format("Partial bonus. Short circuit count: {0}. ", shortCount); } points += ActivitySettings.pointsPerChallenge - deductions; } else { report += string.Format("Correct final result, but unfortunately {0} short circuits. ", shortCount); } } else if (switch1Test.TestComplete || switch2Test.TestComplete || closedCount > 0) { points = (ActivitySettings.pointsPerChallenge / 3) - deductions; report += "Got one switch working correctly, which is a start. "; if (shortCount > 0) { if (shortCount > 1) { report += string.Format("But there were {0} short circuits. ", shortCount); } else { report += "But there was a short circuit. "; } } } else { report += "Not much to report here. No connections made. "; if (shortCount > 0) { if (shortCount > 1) { report += string.Format("But you did manage {0} short circuits. ", shortCount); } else { report += "But you did manage a short circuit. "; } } } Utils.RegisterActivityAndUpdateExperience(points); if (infoPanel) { infoPanel.SetText(report + "Points earned: " + ActivitySettings.Asset.currentActivityScore); infoPanel.TryBonus(); infoPanel.ShowFor(ActivitySettings.Asset.titleDisplayTime, () => { PostExit(true); }); } }
private void Finish() { int deductions = 0; int bonus = 0, score = 0; string response = ""; DisableTimer(); complete = true; if (catastrophicFail) { response = "You activated a fuse that was off! Very dangerous. Someone may be working on that circuit. "; } else { bool gotResult = selectedSwitches.Contains(correctFuseToSwitchOff); if (gotResult) { response += string.Format("Fuse {0} is correct. ", correctFuseToSwitchOff); if (selectedSwitches.Count == 1) { response += "Sensational! Did it first try. Sorry about the damaged fuse chart, but you worked around it. "; PlayReward(); } else { response += "Faulty circuit shut down. Summary of search for BB power point fuse: "; } } foreach (var s in selectedSwitches) { if ((s >= 1 && s <= 6) || s == 10 || s == 12 || s == 14 || s == 15) { response += string.Format("Fuse {0} is clearly marked, and doesn't match. ", s); deductions += deductForLabelledFuse; } else if (s == 11 || s == 13) { response += string.Format("It couldn't be fuse {0}, as it was down while the powerpoint was sparking. What's more, it's very dangerous closing an unknown fuse! ", s); deductions += deductForDownFuse; } else if (s == 7 || s == 9) { response += string.Format("Fuse {0} is in the part of a clear sequence in the chart, and doesn't match BB. ", s); deductions += deductForSequenceFuse; } } if (gotResult) { score = ActivitySettings.pointsPerChallenge - deductions; if (deductions < 5) { bonus = ActivitySettings.pointsPerChallenge - deductions; } } } Utils.RegisterActivityAndUpdateExperience(score + bonus); response += "Points: " + ActivitySettings.Asset.currentActivityScore; storeRoomInfoPanel.SetText(response); storeRoomInfoPanel.TryBonus(); infoPanel.SetText(response); infoPanel.TryBonus(); infoPanel.ShowFor(ActivitySettings.Asset.titleDisplayTime, () => { PostExit(true); }); }
public void Score(Graspable grabbable) { string result = ""; int score = 0; int total = 0; foreach (var p in pourables) { bool correct = saladRecipe.IsCorrect(p.name, p.ActualAmount); if (correct) { score++; } total++; result += string.Format("\n{0}: {1}. ", p.name, correct ? "correct" : "wrong"); } foreach (var kv in addedItems) { bool correct = true; // made false if there are prep steps and they're wrong if (prepSteps.ContainsKey(kv.Key)) { var arr = prepSteps[kv.Key].ToArray(); if (arr.Length > 0) { if (!saladRecipe.PreparationCorrect(kv.Key, arr)) { correct = false; } } } else if (kv.Value != 0) { correct = false; } correct = correct && saladRecipe.IsCorrect(kv.Key, kv.Value); if (correct) { score++; } total++; result += string.Format("\n{0}: {1}", kv.Key, correct ? "correct" : "wrong"); } Debug.Log(result); float unitVal = Utils.UnitValueChallengeScore(score, total); int activityScore = Utils.ConvertToActivityScore(unitVal); Utils.RegisterActivityAndUpdateExperience(activityScore); infoPanel.SetText(string.Format("Your score is {0} out of {1}", activityScore, ActivitySettings.pointsPerChallenge)); if (unitVal > .85f) { chefExpression.Happy(); } else if (unitVal > .45f) { chefExpression.Skeptical(); } else { chefExpression.Angry(); } infoPanel.ShowFor(ActivitySettings.Asset.infoDisplayTime, () => { ActivityManager.Instance.FadeOutThen(() => { ActivityManager.Instance.Next(); }); }); }