private void TransitionToStateGoToSound(DetectedSound detectedSound, float newSoundPriority) { lastDetectedSound = detectedSound; timeSinceLastSound = 0; currentState = newSoundPriority > sprintThreshold ? MonsterState.SprintToSound : MonsterState.GoToSound; monsterStateGoToSound.EnterState(lastDetectedSound, currentState); }
// Just always hear the sound if we get sent this public void DetectDistractionSound(DetectedSound detectedSound) { if (monsterStateGoToSound != null) { float newSoundPriority = detectedSound.GetPriority(transform.position); TransitionToStateGoToSound(detectedSound, newSoundPriority); } }
// When a sound make a noise, it calls this to alert the monster to it public void DetectSound(DetectedSound detectedSound) { if (monsterStateGoToSound != null) { // Sound priority must be above threshold float newSoundPriority = detectedSound.GetPriority(transform.position); if (newSoundPriority > hearSoundThreshold) { TransitionToStateGoToSound(detectedSound, newSoundPriority); } } }
private void ExitStateInvestigatePoint() { lastDetectedSound = null; currentState = MonsterState.Wander; monsterStateWander.EnterState(); }