public void UpdateScore() { score += 10; scoreText.text = "SCORE: " + score; _scoreUntilLife += 10; if (_scoreUntilLife >= _scoreForLife) { _scoreUntilLife = 0; _player = GameObject.Find("Player(Clone)").GetComponent <Player>(); //Altero a velocidade de todos os inimigos diretamente no Script EnemyAI(pela variavel ser static) EnemyAI._speed += 1; if (_player) { _volumeEffect = _optionsManager.GetEffectVolume(); if (_player.GetLifes() < 3) { //O que vai tocar, posicao na tela, volume AudioSource.PlayClipAtPoint(_clipSoundGainLife, Camera.main.transform.position, _volumeEffect); _player.RemoveDamage(); } else { score += _scoreBonus; scoreText.text = "SCORE: " + score; //O que vai tocar, posicao na tela, volume AudioSource.PlayClipAtPoint(_clipSoundGainPoints, Camera.main.transform.position, _volumeEffect); } } } }
void Start() { _optionsManager = GameObject.Find("OptionsManager").GetComponent <VolumeOptions>(); _volumeEffect = _optionsManager.GetEffectVolume(); _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); //_audioSourcePowerUp = GetComponent<AudioSource>(); PowerUpSpawn(); }
// Start is called before the first frame update void Start() { _optionsManager = GameObject.Find("OptionsManager").GetComponent <VolumeOptions>(); _volumeEffect = _optionsManager.GetEffectVolume(); _audioSourceExplosion = GetComponent <AudioSource>(); _audioSourceExplosion.volume = _volumeEffect; _audioSourceExplosion.Play(); //Destrua esse objeto depois de 4s Destroy(this.gameObject, 4f); }
// Update is called once per frame void Update() { //Debug.Log(Time.time); _volumeEffect = _optionsManager.GetEffectVolume(); _audioSrc.volume = _volumeEffect; Player_movement(); //Left click mouse(0) if (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0)) { Shoot(); } }