Exemplo n.º 1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        m_rigidbody2D = PlayerManager.Instance.PlayerReference.GetComponent <Rigidbody2D>();
        m_playerMovementControllerAir    = PlayerManager.Instance.PlayerReference.GetComponent <PlayerMovementControllerAir>();
        m_playerMovementControllerGround = PlayerManager.Instance.PlayerReference.GetComponent <PlayerMovementControllerGround>();

        m_gravityScale                           = m_rigidbody2D.gravityScale;
        m_rigidbody2D.gravityScale               = 0;
        m_playerMovementControllerAir.enabled    = true;
        m_playerMovementControllerGround.enabled = false;
    }
Exemplo n.º 2
0
    public void OnPlayerEnter(GameObject player)
    {
        if (!m_playerMotion.UseWings)
        {
            m_rigidbody2D = player.GetComponent <Rigidbody2D>();
            m_playerMovementControllerAir    = player.GetComponent <PlayerMovementControllerAir>();
            m_playerMovementControllerGround = player.GetComponent <PlayerMovementControllerGround>();

            m_gravityScale                           = m_rigidbody2D.gravityScale;
            m_rigidbody2D.gravityScale               = 0;
            m_playerMovementControllerAir.enabled    = true;
            m_playerMovementControllerGround.enabled = false;
        }
    }