Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     sgs = GameObject.Find("shotgun Variant").GetComponent <ShotgunScript>();
     mgs = GameObject.Find("machinegun").GetComponent <machineGunScript>();
     sns = GameObject.Find("sniper").GetComponent <SniperScript>();
     ChooseGun();
 }
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.name == "Player")
     {
         machineGunScript sgs = collision.transform.Find("Head").transform.Find("machinegun").GetComponent <machineGunScript>();
         sgs.totalAmmo += ammoAmmount;
         sgs.SendMessage("UpdateAmmo");
         Destroy(gameObject);
     }
 }