12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- using KairoEngine.Core;
- namespace KairoEngine.Core.GameActions
- {
- [System.Serializable, HideReferenceObjectPicker]
- public class GameActionTrigger : IComparable<GameActionTrigger>
- {
- public virtual string name { get; }
- public virtual GameActionTriggersController controller { get => _controller; set => _controller = value; }
- protected internal GameActionTriggersController _controller;
-
- public virtual string GetTypeName() => "GameActionTrigger";
- public virtual string GetTriggerName() => "Generic Trigger";
- [HideInInspector] public string typeName = "GameActionTrigger";
- [HideInInspector] public string className;
-
-
- /// <summary> Fired when the action starts executing.</summary>
- public virtual void OnEnable() { }
- /// <summary>Fired every frame while executing this trigger.</summary>
- public virtual void Update() { }
- /// <summary>Fired when the trigger stops executing.</summary>
- public virtual void OnDisable() { }
- public static GameActionTriggerBase InvokeStringMethod(string typeName, string methodName, string data)
- {
- Type calledType = Type.GetType(typeName);
- GameActionTriggerBase trigger = (GameActionTriggerBase)calledType.InvokeMember($"JSONTo{methodName}",
- System.Reflection.BindingFlags.InvokeMethod |
- System.Reflection.BindingFlags.Public |
- System.Reflection.BindingFlags.Static,
- null, null, new object[] { data });
- return trigger;
- }
- public int CompareTo(GameActionTrigger other)
- {
- if(other == null) return 1;
- else return -1;
- }
- public virtual void OnBeforeSerialize(GameActionObjectSerializer serializer, int n) { }
- public virtual void OnBeforeDeserialize(GameActionObjectSerializer serializer, int n) { }
- }
- public class GameActionTriggerBase : GameActionTrigger
- {
-
- }
- }
|