public void FinishLevel() { if (debugging) { Debug.Log("Level finished."); } //Write the end of the log DijkstraMovementManager DMM = FindObjectOfType <DijkstraMovementManager>(); if (DMM != null) { DMM.WriteToLogAppendScore("Level Finished; Player has finished the level"); ProfessorButton pButton = FindObjectOfType <ProfessorButton>(); OnClickRoutingTable rButton = FindObjectOfType <OnClickRoutingTable>(); DMM.WriteToLog("Summary; Printing the Summary of stats for this run:"); DMM.WriteToLog(""); DMM.WriteToLog("Buttons; Professor Button clicks= " + pButton.GetClickCount()); DMM.WriteToLog("Buttons; Routing Table Button clicks=" + rButton.GetClickCount()); //errors DMM.WriteToLog("Errors; #Error Recovery= " + DMM.countErrorRecovery); DMM.WriteToLog("Errors; #NOPs = " + DMM.countNoOp); DMM.WriteToLog("Errors; #Wrong Hops= " + DMM.countWrongHop); DMM.WriteToLog("Errors; #UndiscoveredPaths= " + DMM.countUndiscoveredPaths); //sound -> AudioMenuMain private readonly string MASTER_VOL = "MasterVol", GAME_VOL = "GameVol", UI_VOL = "UiVol", PROF_VOL = "ProfVol", BACKGROUND_VOL = "BackgroundVol"; DMM.WriteToLog("Sound; Master: " + PlayerPrefs.GetFloat(AudioMenuMain.MASTER_VOL)); DMM.WriteToLog("Sound; Game: " + PlayerPrefs.GetFloat(AudioMenuMain.GAME_VOL)); DMM.WriteToLog("Sound; UI: " + PlayerPrefs.GetFloat(AudioMenuMain.UI_VOL)); DMM.WriteToLog("Sound; Professor: " + PlayerPrefs.GetFloat(AudioMenuMain.PROF_VOL)); DMM.WriteToLog("Sound; Background: " + PlayerPrefs.GetFloat(AudioMenuMain.BACKGROUND_VOL)); } // Play beer drink animation after a short time. StartCoroutine(DrinkBeerAfterTime()); }
// OnStateExit is called before OnStateExit is called on any state inside this state machine override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { professorController = GameObject.FindWithTag("Professor").GetComponent <ProfessorController>(); HotPotatoTimer hotpotatoTimer = FindObjectOfType <HotPotatoTimer>(); // Init current level controller. levelController = LevelController.GetCurrentLevelController(); if (stateInfo.IsName("Appear") || stateInfo.IsName("AppearBeer") || stateInfo.IsName("AppearBeerGlass") || stateInfo.IsName("AppearAngry") || stateInfo.IsName("AppearMoney")) { // Activate speech bubble. professorController.speechBubble.gameObject.SetActive(true); // Show speech bubble. professorController.speechBubble.SetVisible(true); } else if (stateInfo.IsName("Disappear") || stateInfo.IsName("DisappearBeer") || stateInfo.IsName("DisappearBeerGlass") || stateInfo.IsName("DisappearAngry") || stateInfo.IsName("DisappearMoney")) { professorController.SetVisible(false); // Hide professor button. ProfessorButton professorButton = FindObjectOfType <ProfessorButton>(); if (professorButton != null) { professorButton.SetVisible(true); } // Deactivate speech bubble. professorController.speechBubble.gameObject.SetActive(false); // Enable gameplay interaction on current level controller. if (levelController != null) { levelController.SetGameInputEnabled(true); } // Invoke OnStopDisappear method on level controller. if (levelController != null) { levelController.OnStopProfessorDisappear(); } // when hotpotato is active, resume timer when prof disappears if (hotpotatoTimer != null) { hotpotatoTimer.ResumeTimer(); } //Enable Camera movement when the prof is gone. CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>(); if (camera != null) { camera.EnableMovement(true); } } }
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { professorController = GameObject.FindWithTag("Professor").GetComponent <ProfessorController>(); HotPotatoTimer hotpotatoTimer = FindObjectOfType <HotPotatoTimer>(); // Init current level controller. levelController = LevelController.GetCurrentLevelController(); if (stateInfo.IsName("Appear") || stateInfo.IsName("AppearBeer") || stateInfo.IsName("AppearBeerGlass") || stateInfo.IsName("AppearAngry") || stateInfo.IsName("AppearMoney")) { professorController.SetVisible(true); // Hide professor button. ProfessorButton professorButton = FindObjectOfType <ProfessorButton>(); if (professorButton != null) { professorButton.SetVisible(false); } // Disable gameplay interaction on current level controller. if (levelController != null) { levelController.SetGameInputEnabled(false); } //when hotpotato is the game mode and the prof appears, stop timers if (hotpotatoTimer != null) { hotpotatoTimer.PauseTimer(); //disable movement of the cam when the prof is visible CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>(); if (camera != null) { camera.EnableMovement(false); } } } else if (stateInfo.IsName("Disappear") || stateInfo.IsName("DisappearBeer") || stateInfo.IsName("DisappearBeerGlass") || stateInfo.IsName("DisappearAngry") || stateInfo.IsName("DisappearMoney")) { // Hide speech bubble. professorController.speechBubble.SetVisible(false); } else if (stateInfo.IsName("Money") || stateInfo.IsName("Money2") || stateInfo.IsName("Money3")) { // Reset money animation flag. professorController.Money(false); } }
// Use this for initialization void Start() { showBeer = false; blink = false; rnd = new System.Random(); audioGetBeer = GetComponents <AudioSource>(); audioVoice = audioGetBeer[2]; sequence = sequences.GetSequence(0); speechBubble.SetStates(sequence.states); professorButton = FindObjectOfType <ProfessorButton>(); //Debug.Log("Prof"); //foreach(SpeechBubbleSequence s in sequences.sequences.Values) //{ // foreach(SpeechBubbleState state in s.states.Values) // { // Debug.Log(">>>>" + state.Text + " from " + s.gameObject.name); // } //} }