/// <summary> /// Use this for initialization /// </summary> void Start() { m_rigidbody = this.GetComponent <Rigidbody>(); if (m_rigidbody == null) { Debug.LogError("Failed to find a rigid body on the player."); } m_viewCamera = Camera.main; m_stateMachine = this.GetComponent <PlayMakerFSM>(); if (m_stateMachine == null) { Debug.LogError("Failed to find a state machine on the player."); } m_canPlayerMove = m_stateMachine.FsmVariables.FindFsmBool("PlayerCanMove"); m_canPlayerLook = m_stateMachine.FsmVariables.FindFsmBool("PlayerCanLook"); m_playerHasLookedAround = m_stateMachine.FsmVariables.FindFsmBool("PlayerHasLookedAround"); m_playerHasGun = m_stateMachine.FsmVariables.FindFsmBool("HasGun"); m_pickupHook = this.GetComponentInChildren <SpringJoint>(); var gun = this.transform.FindChild("Main Camera/Gun"); m_gunMaterial = gun.GetComponent <Renderer>().sharedMaterial; m_gunAudio = gun.GetComponent <AudioSource>(); m_gunMaterial.SetColor("_EmissionColor", m_startColor); m_controlActions = new CharacterControlActions(); m_controlActions.Setup(); Cursor.lockState = CursorLockMode.Locked; }
public override void OnEnter() { m_actionSet = new CharacterControlActions(); m_actionSet.Setup(); }