예제 #1
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            float bound = m_PlayerController.GetBoundY();

            if (m_Platform.transform.position.y - m_Player.transform.position.y < m_DownDistance * m_Platform.transform.localScale.y &&
                m_Player.transform.position.y - m_Platform.transform.position.y < m_UpDistance * m_Platform.transform.localScale.y &&
                Mathf.Abs(bound - m_Player.transform.position.y) > 0.001f)
            {
                m_Velocity = m_PlayerController.GetVelocity();
                Debug.Log("Stay");
                m_PlayerController.SetVelocity(m_Velocity);
            }
            else
            {
                PushPlayer();
            }
        }
    }