Beispiel #1
0
    private void Move()
    {
        m_Rigidbody2D.velocity = new Vector2(m_HorizontalAxis * m_MoveSpeed, m_Rigidbody2D.velocity.y);

        Vector3 m_MousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if (m_MousePos.x > transform.position.x)
        {
            transform.GetChild(0).localScale = new Vector3(1, transform.localScale.y, 0);
        }
        else if (m_MousePos.x < transform.position.x)
        {
            transform.GetChild(0).localScale = new Vector3(-1, transform.localScale.y, 0);
        }

        if (m_Rigidbody2D.velocity.x != 0 && m_Jumper.IsGrounded() && !playingSound)
        {
            StartCoroutine(MoveSound());
        }
    }
Beispiel #2
0
 private bool IsGrounded()
 {
     return(jumper.IsGrounded());
 }