Пример #1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.GetComponent <GroundTypeContainer>() != null && !jumped)
        {
            GroundType groundType = other.gameObject.GetComponent <GroundTypeContainer>().groundType;
            if ((groundType == GroundType.Flat) || (groundType == GroundType.Ramp && other.gameObject.transform.localScale.x < 0))
            {
                walkVelX = 2f; walkVelY = 0f;
            }

            else if (groundType == GroundType.Ramp && other.gameObject.transform.localScale.x > 0)
            {
                // print("this is working");
                //THIS MAKES HIM HOP WHEN HE GOES UP
                walkVelX = 2f; walkVelY = 0f;                 //walkVelY = 1.4f;
            }

            grounded = true;
        }


        else if (other.gameObject.GetComponent <GameOverObjectCollider>() != null)
        {
            // print("working");
            coll.enabled = false;
            Explode();
            camera.CallCameraShake();
        }

        // else {
        //  grounded = true;
        // }
    }