// 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 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); } }