예제 #1
0
    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);
        }
    }
예제 #2
0
 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>();
 }
예제 #3
0
    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();
        }
    }
예제 #4
0
    /*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);
    }
예제 #5
0
 public Hero(IHeroState hero)
 {
     State = hero;
 }