예제 #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();
 }
예제 #2
0
 void Start()
 {
     playerHealth   = GameObject.Find("Player").GetComponent <PlayerHealth>();
     ammoShotgun    = GameObject.Find("shotgun").GetComponent <ShotgunScript>();
     ammoUzi        = GameObject.Find("uzi").GetComponent <UziScript>();
     playerTf       = GameObject.Find("Player").GetComponent <Transform>();
     victoryTrigger = GameObject.Find("Victory Detector").GetComponent <VictoryTrigger>();
     gs             = gameState.playing;
     ws             = weaponSwitchingState.shotgun;
 }
 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);
     }
 }