Ejemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        GameObject source = other.gameObject;

        if (source.tag == "Enemy")
        {
            goombaBehave = source.GetComponent <GoombaBehaviour>();

            if (goombaBehave.Isalive())
            {
                KillPlayer();
            }
        }
        else if (other.gameObject.tag == "PowerUp")
        {
            UpTheAnte();
        }
    }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D other)
    {
        GameObject source = other.gameObject;

        if (source.tag == "Enemy")
        {
            goombaBehave = source.GetComponent <GoombaBehaviour>();
            Debug.Log("hit by enemy");
            state -= 1;
            if (state == 0 && goombaBehave.Isalive())
            {
                KillPlayer();
            }
        }
        else if (other.gameObject.tag == "PowerUp")
        {
            GoBig();
        }
    }
Ejemplo n.º 3
0
    void OnCollisionEnter2D(Collision2D other)
    {
        GameObject source = other.gameObject;

        if (source.tag == "Enemy")
        {
            GoombaBehaviour goombaBehave = source.GetComponent <GoombaBehaviour>();
            if (goombaBehave.Isalive())
            {
                KillPlayer();
            }
            else
            {
                // bounce of enemy
                rb.velocity = transform.up * enemyBounceOfForce;
            }
        }
        else if (other.gameObject.tag == "PowerUp")
        {
            UpTheAnte();
        }
    }