// used for game logic stuff void Update() { // reset angular velocity rigidbody.angularVelocity = Vector3.zero; FSM.Update(); if (Input.GetKeyUp(settings.KeyJump)) { JumpKeyReleased = true; } UpdateWhistling(); UpdateShouting(); UpdateShushing(); // Update control of voice input // Note that if both players are pressing, none gets voice control! if (Input.GetKey(settings.KeyPlayer1Input) && Input.GetKey(settings.KeyPlayer2Input)) { PlayerOneActive = PlayerTwoActive = false; BothPlayersActive = true; ConfusingSpawn.EnableSpawning(); } else if (Input.GetKey(settings.KeyPlayer1Input)) { PlayerOneActive = true; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } else if (Input.GetKey(settings.KeyPlayer2Input)) { PlayerTwoActive = true; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } else { PlayerOneActive = PlayerTwoActive = false; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } if (PlayerOneActive) { meshRenderer.material.color = Color.blue; } else if (PlayerTwoActive) { meshRenderer.material.color = Color.red; } else { meshRenderer.material.color = Color.white; } // Check whether player wants to return to main menu if (Input.GetKey(KeyCode.Escape)) { LastCheckpoint = null; LevelChange.changeLevel(0); } }