void Awake() { _playerAudio = GetComponent <AudioSource>(); _movement = GetComponent <TankMovement>(); _gun = GetComponentInChildren <TimedGun>(); health = startingHealth; _startingHealthIconColour = healthIcon.color; }
private void SelectWeapon() { if (_prevSelectedWeapon == selectedWeaponIndex) { return; } int i = 0; foreach (Transform weapon in transform) { if (i == selectedWeaponIndex) { weapon.gameObject.SetActive(true); selectedWeapon = weapon.GetComponent <TimedGun>(); } else { weapon.gameObject.SetActive(false); } i++; } }