Пример #1
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        // wall
        if (coll.gameObject.layer == 12)
        {
            return;
        }

        if (coll.transform.tag == "Ammo")
        {
            if (myPlayerShoot.currentAmmo < myPlayerShoot.maxAmmo)
            {
                // TODO: play cheese KAZING/ammobelt sound here.

                myPlayerShoot.AddAmmo(coll.transform.GetComponent <item>().Amount);

                GameMaster.GetComponent <guimanager>().UpdateAmmoCount(myPlayerShoot.currentAmmo);

                coll.transform.GetComponent <item>().StartPickUp();

                Destroy(coll.gameObject, 5f);
            }
            {
                kickThing(coll);
            }
        }
        else if (coll.transform.tag == "Health")
        {
            if (myPlayerHealth.currentHealth < myPlayerHealth.maxHealth)
            {
                // TODO: play "uugh" sound effect here :D

                myPlayerHealth.healDamage(coll.transform.GetComponent <item>().Amount);

                coll.transform.GetComponent <item>().StartPickUp();

                Destroy(coll.gameObject, 5f);
            }
            {
                kickThing(coll);
            }
        }
        else if (coll.transform.tag == "Points")
        {
            // TODO: play kazing/GOLD sound here.

            GetComponent <player>().playerScore += coll.transform.GetComponent <item>().Amount;

            coll.transform.GetComponent <item>().StartPickUp();

            Destroy(coll.gameObject, 5f);
        }
        else if (coll.transform.tag == "Props")
        {
            kickThing(coll);
        }
    }