BREAKING CHANGE: State 0.2.0
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
using System;
|
||||
using Syntriax.Modules.ToggleState;
|
||||
using Syntriax.Modules.State;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Syntriax.Modules.Action
|
||||
{
|
||||
public abstract class ActionBase : MonoBehaviour, IAction
|
||||
{
|
||||
public IToggleState MemberToggleState { get; protected set; } = null;
|
||||
public IStateEnable StateEnable { get; protected set; } = null;
|
||||
public Action<IAction> OnActivated { get; set; } = null;
|
||||
|
||||
protected IToggleState toggleState = null;
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
toggleState = GetComponent<IToggleState>();
|
||||
MemberToggleState = new ToggleStateMember(true);
|
||||
StateEnable = new StateEnableMember(true);
|
||||
OnActivated += (_) => OnActionActivated();
|
||||
}
|
||||
|
||||
@@ -24,7 +22,7 @@ namespace Syntriax.Modules.Action
|
||||
protected abstract void OnActionActivated();
|
||||
public virtual void Activate()
|
||||
{
|
||||
if (!MemberToggleState.IsToggledNullChecked() || !toggleState.IsToggledNullChecked())
|
||||
if (!StateEnable.IsEnabledNullChecked())
|
||||
return;
|
||||
|
||||
OnActivated?.Invoke(this);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Syntriax.Modules.ToggleState;
|
||||
using Syntriax.Modules.State;
|
||||
|
||||
namespace Syntriax.Modules.Action
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace Syntriax.Modules.Action
|
||||
protected abstract void OnActionDeactivated();
|
||||
public virtual void Deactivate()
|
||||
{
|
||||
if (!MemberToggleState.IsToggledNullChecked() || !toggleState.IsToggledNullChecked())
|
||||
if (!StateEnable.IsEnabledNullChecked())
|
||||
return;
|
||||
|
||||
OnDeactivated?.Invoke(this);
|
||||
|
@@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using Syntriax.Modules.ToggleState;
|
||||
using Syntriax.Modules.State;
|
||||
|
||||
namespace Syntriax.Modules.Action
|
||||
{
|
||||
public interface IAction
|
||||
{
|
||||
/// <summary>
|
||||
/// The member <see cref="IToggleState"/> the Action uses to check if it's active or not
|
||||
/// The member <see cref="IStateEnable"/> the Action uses to check if it's active or not
|
||||
/// </summary>
|
||||
IToggleState MemberToggleState { get; }
|
||||
IStateEnable StateEnable { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the <see cref="IAction"/> is Activated
|
||||
|
Reference in New Issue
Block a user