// Start is called before the first frame update void Start() { _player = GameObject.Find("Player").GetComponent <PlayerHealthAndDamage>(); if (_player == null) { Debug.Log("Player is NULL"); } _healthText.text = "Health"; }
void Start() { _spawnManager = GameObject.Find("SpawnManager").GetComponent <SpawnManager>(); _player = GameObject.Find("Player").GetComponent <PlayerHealthAndDamage>(); _wavePanel.SetActive(true); if (_player == null) { Debug.Log("Missing Player Health"); } if (_spawnManager == null) { Debug.Log("Cant find spawn manager"); } }
private void Start() { if (_sfxSource != null) { AudioManager.Instance.PlayEffect(_sfxSource, _fireVolume); } playerObj = GameObject.Find("Player"); if (playerObj == null) { Debug.Log("Player is NULL"); } else { player = playerObj.GetComponent <PlayerHealthAndDamage>(); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "PowerUp") { WeaponPowerUp weaponPowerUp = other.transform.GetComponent <WeaponPowerUp>(); PlayerHealthAndDamage playerHealth = GameObject.Find("Player").GetComponent <PlayerHealthAndDamage>(); _weaponPowerUpID++; playerHealth.health = playerHealth.maximumHealth; if (weaponPowerUp != null) { switch (_weaponPowerUpID) { case 0: _weaponCurrentlyOn = CurrentWeapon.FirstWeapon; break; case 1: _weaponCurrentlyOn = CurrentWeapon.SecondWeapon; break; case 2: _weaponCurrentlyOn = CurrentWeapon.ThirdWeapon; break; case 3: _weaponCurrentlyOn = CurrentWeapon.FourthWeapon; break; case 4: _weaponCurrentlyOn = CurrentWeapon.FifthWeapon; break; default: Debug.Log("Invalid ID!"); break; } } } Destroy(other.gameObject); }
private void OnTriggerEnter(Collider other) { if (other.tag == "PowerUp") { Destroy(other.gameObject); transform.GetComponent <PlayerScore>().AddScore(_powerUpPointVal); PlayerHealthAndDamage playerHealth = GameObject.Find("Player").GetComponent <PlayerHealthAndDamage>(); if (_weaponPowerLevel < _totalWepCount) { _weaponPowerLevel++; UpdateWeaponLevel(); } if (playerHealth.health < playerHealth.maximumHealth) { playerHealth.health++; } SwitchPowerUp(); } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { PlayerHealthAndDamage player = other.GetComponent <PlayerHealthAndDamage>(); if (player != null) { player.PlayerDamage(); if (_explosionAnim != null) { GameObject explosion = Instantiate(_explosionAnim, transform.position, Quaternion.identity); explosion.gameObject.GetComponent <ExplosionAnim>()._sfxSource = _hitSfxsource; explosion.gameObject.GetComponent <ExplosionAnim>()._volume = _hitVolume; } Destroy(gameObject); } } }
void Start() { _player = GameObject.Find("Player"); _wavePanelManager = GameObject.Find("Wave_Panel").GetComponent <WavePanelManager>(); _playerScore = GameObject.Find("Player").GetComponent <PlayerScore>(); _scoreDisplayUI = GameObject.Find("Canvas").GetComponent <Score_Display_UI>(); _playerHP = GameObject.Find("Player").GetComponent <PlayerHealthAndDamage>(); _bgColor = GameObject.Find("Environment").GetComponent <BackgroundColorChange>(); _canvasManager = GameObject.Find("Canvas").GetComponent <CanvasManager>(); if (_bgColor == null) { Debug.LogError("Cant find Background color change"); } if (_playerHP == null) { Debug.LogError("Cant find Player Hp and Damage"); } if (_player == null) { Debug.LogError("Cant find player for SpawnManager"); } if (_wavePanelManager == null) { Debug.LogError("Cant find WavePanelManger ui component"); } if (_scoreDisplayUI == null) { Debug.Log("Cant find the UI for SpawnManager"); } if (spawnPoints.Length <= 0) { Debug.LogError("No SpawnPoints found"); } waveCountdown = timeBetweenWaves; }
void Start() { anim = GetComponent <Animator>(); playerHealth = FindObjectOfType <PlayerHealthAndDamage>(); currentPlayerHealth = playerHealth.health.CurrentVal; }