Exemple #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "MachinegunPickup")
        {
            spriteRenderer.sprite = guns[1];
            selectedWeapon        = 1;
            Gun.ammo = 100;
            collision.gameObject.SetActive(false);
        }

        if (collision.gameObject.tag == "ShotgunPickup")
        {
            spriteRenderer.sprite = guns[2];
            selectedWeapon        = 2;
            Gun.ammo = 60;
            collision.gameObject.SetActive(false);
        }

        if (collision.gameObject.tag == "HealthPickup")
        {
            player.FullHealth();
            collision.gameObject.SetActive(false);
        }

        if (collision.gameObject.tag == "JetpackPickup")
        {
            player.ActivateJetPack();
            collision.gameObject.SetActive(false);
        }
    }