12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System.Collections;
- using System.Linq;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- using KairoEngine.Core;
- namespace KairoEngine.Core.GameActions
- {
- [System.Serializable, HideReferenceObjectPicker]
- public class OnStartGameActionTrigger : GameActionTriggerBase
- {
- public override string name
- {
- get
- {
- return $"On Start";
- }
- }
- public override GameActionTriggersController controller {
- get => _controller;
- set
- {
- _controller = value;
- typeName = "OnStartGameActionTrigger";
- }
- }
- public override string GetTypeName() => "OnStartGameActionTrigger";
- public override string GetTriggerName() => "On Start";
- [FoldoutGroup("@name")]
- public float delay = 0;
- private float _counter = 0;
- public override void OnEnable()
- {
- _counter = 0f;
- }
- public override void Update()
- {
- _counter += Time.deltaTime;
- if(_counter > delay) controller.TriggerActions();
- }
- public override void OnDisable() { }
- public static OnStartGameActionTrigger JSONToOnStartGameActionTrigger(string data)
- {
- return JsonUtility.FromJson<OnStartGameActionTrigger>(data);
- }
- private OnStartGameActionTrigger Duplicate()
- {
- OnStartGameActionTrigger trigger = new OnStartGameActionTrigger();
- trigger.controller = controller;
- return trigger;
- }
- }
- }
|