/// <summary> /// Switch to the previous or next genre. /// </summary> /// <param name="next">Switch to the next genre?</param> public void SwitchGenres(bool next) { m_CharacterController.TryStopAllAbilities(true); m_Character.SetActive(false); m_CurrentGenre = (Genre)(((int)m_CurrentGenre + (next ? 1 : -1)) % (int)Genre.Last); if ((int)m_CurrentGenre < 0) { m_CurrentGenre = Genre.PointClick; } m_GenreTitle.text = m_Title[(int)m_CurrentGenre]; m_GenreDescription.text = m_Description[(int)m_CurrentGenre]; m_WeaponWheel.SetActive(false); SwitchCharacters(); GenreSwitched(); m_HasLoaded[(int)m_CurrentGenre] = true; }
/// <summary> /// The genre has been switched. Update the various object references. /// </summary> private void GenreSwitched() { switch (m_CurrentGenre) { case Genre.Shooter: m_CameraHandler.ZoomStateName = "Zoom"; m_CameraController.ChangeState("TopDown", false); m_CameraController.ChangeState("ThirdPerson", true); m_Crosshairs.SetActive(true); m_WeaponWheel = m_CombatWeaponWheel; break; case Genre.Adventure: m_WeaponWheel = m_AdventureWeaponWheel; break; case Genre.RPG: m_CameraController.ChangeState("ThirdPerson", false); m_CameraController.ChangeState("RPG", true); m_WeaponWheel = m_RPGWeaponWheel; break; case Genre.Platformer: m_CameraHandler.ZoomStateName = "Zoom"; m_CameraController.ChangeState("RPG", false); m_CameraController.ChangeState("ThirdPerson", true); m_Crosshairs.SetActive(true); m_Pseudo3DObjects.SetActive(false); m_WeaponWheel = m_CombatWeaponWheel; break; case Genre.Pseudo3D: m_CameraHandler.ZoomStateName = string.Empty; m_CameraController.ChangeState("ThirdPerson", false); m_CameraController.ChangeState("Pseudo3D", true); m_Crosshairs.SetActive(false); m_Pseudo3DObjects.SetActive(true); m_WeaponWheel = m_CombatWeaponWheel; break; case Genre.TopDown: m_CharacterController.Movement = RigidbodyCharacterController.MovementType.TopDown; m_CameraController.ChangeState("Pseudo3D", false); m_CameraController.ChangeState("TopDown", true); m_Crosshairs.SetActive(false); m_Pseudo3DObjects.SetActive(false); break; case Genre.PointClick: m_CharacterController.Movement = RigidbodyCharacterController.MovementType.PointClick; m_Crosshairs.SetActive(false); break; } m_WeaponWheel.SetActive(true); for (int i = 0; i < m_ItemPickups.childCount; ++i) { m_ItemPickups.GetChild(i).gameObject.SetActive(true); } // Start fresh. if (m_HasLoaded[(int)m_CurrentGenre]) { m_CharacterInventory.RemoveAllItems(false); m_CharacterInventory.LoadDefaultLoadout(); } m_CharacterAnimatorMonitor.PlayDefaultStates(); Respawn(); // Update Blitz. var enableBlitz = m_CurrentGenre == Genre.Shooter || m_CurrentGenre == Genre.Adventure || m_CurrentGenre == Genre.Platformer || m_CurrentGenre == Genre.RPG; if (enableBlitz) { m_BlitzCharacterController.TryStopAllAbilities(); m_BlitzCharacterController.SetPosition(m_BlitzPosition); m_BlitzCharacterController.SetRotation(m_BlitzRotation); } m_Blitz.SetActive(enableBlitz); }