private void Update() { IHeroState newState = heroState.Update(); if (newState != null) { heroState.Exit(); heroState = newState; heroState.Enter(this); } if (Input.GetKeyDown(KeyCode.P)) { SetCrouch(!crouch); } if (Input.GetButtonDown("Interact")) { interactComp.Interact(); } // Debug only. if (Input.GetKeyDown(KeyCode.Q)) { noiseEmitter.MakeNoise(this.gameObject, 1, transform.position); } }
private void Start() { m_Input = GetComponent <InputManager>(); m_State = gameObject.GetComponent <FallingState>(); m_Collision = gameObject.GetComponent <CollisionManager>(); m_CurrentState = m_State.GetStateName(); m_Grav = gameObject.GetComponent <GravityManager>(); }
public void HandleInput(Hero hero, InputManager input, CollisionManager collision, GravityManager grav) { IHeroState state = m_State.HandleInput(hero, m_Input, m_Collision, m_Grav); if (state != null) { //Destroy(m_State as Component); m_State = state; m_State.Enter(hero, m_Input, m_Collision, m_Grav); m_CurrentState = m_State.GetStateName(); } }
/*private struct InventoryWeapons { * BaseWeapon weaponStats; * int currAmmo; * }*/ private void Start() { activeCam = FPCam; coverComp = GetComponent <CoverComponent>(); noiseEmitter = GetComponent <PawnNoiseEmitterComponent>(); interactComp = GetComponent <InteractComponent>(); animController = GetComponentInChildren <Animator>(); collider = GetComponent <CapsuleCollider>(); startColliderHeight = collider.height; heroState = new StandingState(); heroState.Enter(this); }
public Hero(IHeroState hero) { State = hero; }