private void LateUpdate() { if (_fow.Target != null) { _isAngry = true; } if (_isAngry) { if (!_sound.SoundIsPlaying("FlyingRobotAlarm")) { _sound.Play("FlyingRobotAlarm"); } LookAtTarget(); goToAttack = true; //GoToAttackPos(); Attack(); if (_fow.Target == null) { if (keppFolowing) { StartCoroutine(KeepFolowing(2)); } } } else { if (!_sound.SoundIsPlaying("FlyingRobotSearching")) { _sound.Play("FlyingRobotSearching"); } goToAttack = false; //Patrol(); } }
/// <summary> /// патрулирует местность, При абнаружении цели гонится за ней /// </summary> private void PatrollAndAttack() { if (_fow.Target != null) { _isAngry = true; } if (_isAngry) { if (!_sound.SoundIsPlaying("DogAgro")) { _sound.Play("DogAgro"); } MoveToTarget(); if (_fow.Target == null) { if (keepFolowing) { StartCoroutine(KeepFolowing(1)); } } } else { if (!_sound.SoundIsPlaying("DogMove")) { _sound.Play("DogMove"); } Patrol(); } }
void PlayTheme(string themeName) { if (!_music.SoundIsPlaying(themeName)) { _music.Play(themeName); } }