void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.name == "Player")
     {
         ShotgunScript sgs = collision.transform.Find("Head").transform.Find("shotgun Variant").GetComponent <ShotgunScript>();
         sgs.totalAmmo += ammoAmmount;
         sgs.SendMessage("UpdateAmmo");
         Destroy(gameObject);
     }
 }
示例#2
0
    void ChooseGun()
    {
        switch (currentGunIndex)
        {
        case 0:
            sgs.canShoot = true;
            mgs.canShoot = false;
            sns.canShoot = false;

            allWeaponVisuals[0].SetActive(true);
            allWeaponVisuals[1].SetActive(false);
            allWeaponVisuals[2].SetActive(false);

            sgs.SendMessage("UpdateAmmo");
            break;

        case 1:
            sgs.canShoot = false;
            mgs.canShoot = true;
            sns.canShoot = false;

            allWeaponVisuals[0].SetActive(false);
            allWeaponVisuals[1].SetActive(true);
            allWeaponVisuals[2].SetActive(false);

            mgs.SendMessage("UpdateAmmo");
            break;

        case 2:
            sgs.canShoot = false;
            mgs.canShoot = false;
            sns.canShoot = true;

            allWeaponVisuals[0].SetActive(false);
            allWeaponVisuals[1].SetActive(false);
            allWeaponVisuals[2].SetActive(true);

            sns.SendMessage("UpdateAmmo");
            break;
        }

        currentGun = allWeaponPrefabs[currentGunIndex];
    }