Skip to content
Snippets Groups Projects

Merge Request for Issue/3 Added game event loggers for the four types of basic value game events.

Merged Heine, Eric R requested to merge issue/3-event-loggers into master
9 files
+ 145
1
Compare changes
  • Side-by-side
  • Inline
Files
9
using UnityEngine;
using Shared.ScriptableVariables;
namespace Shared.EventLog {
// Logs a boolean game event when it is raised
// Depends on ScriptableVariable package
public class BooleanGameEventLogger : BooleanGameEventListener {
[Tooltip("The event log to add the event trigger log to")]
public EventLog eventLog;
[Tooltip("The custom key to use in the event log (if not set, the key will be the event name itself)")]
public string customKey;
[Tooltip("The custom format of the event value output (if not set, the value will be the ToString() of the value)")]
public string customValueFormat;
//---------------------------------------------------------------------------
// Overridden event listening function to add the event to the event log
public override void OnEventRaised(bool value) {
eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, !string.IsNullOrEmpty(customValueFormat) ? string.Format(customValueFormat, value) : value.ToString());
base.OnEventRaised(value);
}
}
}
Loading