/// <summary> /// A generic event for various shouts that enemies reacts to. /// </summary> /// <param name="time"></param> public void MadeANoise(float time) { ShoutEventInfo sei = new ShoutEventInfo { playerPosition = Position.position, shoutDuration = time }; EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.Song, sei); }
private void ShoutHasBeenMade(EventInfo eventInfo) { ShoutEventInfo shoutInfo = (ShoutEventInfo)eventInfo; shoutCD.gameObject.SetActive(true); shoutCD.maxValue = shoutInfo.shoutDuration; shoutCD.value = shoutInfo.shoutDuration; StartCoroutine(ShoutCDTimer()); }
/// <summary> /// Transitions to <see cref="AlphaSearchState"/> if the owner is within <see cref="hearingRange"/> distance of the player. /// </summary> /// <param name="eventInfo"> Contains information from <see cref="EventInfo"/></param> public void SearchForPlayer(EventInfo eventInfo) { ShoutEventInfo se = (ShoutEventInfo)eventInfo; if (IsNight && Vector3.Distance(transform.position, se.playerPosition) < hearingRange && Prey != null) { SearchPosition = se.playerPosition; TransitionTo <AlphaSearchState>(); } }