Beispiel #1
0
    private void FixedUpdate()
    {
        MarioControl mc = gameObject.GetComponent <MarioControl>();

        if (mc.GetComponent <MarioControl>().ladderZone)
        {
            mc.GetComponent <Rigidbody2D>().gravityScale = 0f;
        }
        else
        {
            mc.GetComponent <Rigidbody2D>().gravityScale = 1f;
        }
    }
Beispiel #2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        MarioControl mc = collision.gameObject.GetComponent <MarioControl>();

        if (mc != null)
        {
            mc.ladderZone = false;
            mc.GetComponent <Rigidbody2D>().gravityScale = 1f;
        }
    }
Beispiel #3
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        MarioControl mc = gameObject.GetComponent <MarioControl>();

        mc.GetComponent <Rigidbody2D>().gravityScale = 0f;
    }