private void Update() { if (Utility.Elapsed(timeOfLastLook, lookFrequency)) { timeOfLastLook = Time.time; var ray = new Ray(transform.position, transform.forward); if (Physics.Raycast(ray, out var hit)) { var targetMemory = hit.transform.GetMemory(); var targetSeen = false; // Memory-holding targets may store whether they have been seen previously. if (targetMemory != null && targetMemory.TryGetValue("TargetSeen", out var value)) { targetSeen = (bool)value; } var @event = new Dictionary <string, object> { { "Target", hit.transform.gameObject }, { "TargetName", hit.transform.name }, { "TargetSeen", targetSeen }, }; var character = GetCharacterState(); var args = new QueryArgs("SeeObject", "Player", @event, character, Memory); this.PostNotification(Notify.Action <QueryArgs>(), args); } } }
/// <summary> /// Actions to take in response to stimulus. /// </summary> public void Response(Query query) { query.Get <Color>("SubtitleColor", StateSource.Character, out var color); var args = new SubtitleArgs(query.Who, response, color); this.PostNotification(Notify.Action <SubtitleArgs>(), args); }
private void OnDisable() { this.RemoveObserver(OnDialogue, Notify.Action <SubtitleArgs>()); }
private void OnEnable() { this.AddObserver(OnDialogue, Notify.Action <SubtitleArgs>()); }
private void OnDisable() { this.RemoveObserver(OnQueryEvent, Notify.Action <QueryArgs>()); }
private void OnEnable() { this.AddObserver(OnQueryEvent, Notify.Action <QueryArgs>()); }