Esempio n. 1
0
    private void ExecuteMoveInternal(float delta, Vector3 gravity)
    {
        m_Velocity += delta * gravity;
        Vector3   tVelocity  = m_Target.transform.rotation * m_Velocity;
        Vector3   posOff     = tVelocity * delta;
        Vector3   pos        = m_Target.transform.position + posOff;
        Component controller = m_Target.GetComponent <CharacterController>();

        if (controller != null)
        {
            ((CharacterController)controller).Move(posOff);
        }
        else
        {
            m_Target.transform.position += posOff;
        }
        if (m_OnMovePos != null)
        {
            m_OnMovePos(pos, posOff);
        }
        float disWithGround = Script_Util.GetHeightWithGround(m_Target.transform);

        if (disWithGround <= 0 && m_OnHitGround != null)
        {
            m_OnHitGround(m_Target.transform.position, disWithGround);
        }
    }