using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public enum TestState
{ prepare,
start,
end,
}
public class Test : MonoBehaviour
{
public TestState TestStateGetSet
{
get{
return _testState;
}
private set
{
if (value != _testState)
{
TestState oldState = _testState;
_testState = value;
if(TestEvent != null)
TestEvent(_testState, oldState);
}
}
}
private TestState _testState = TestState.prepare;
public static event System.Action<TestState, TestState> TestEvent;
void Start()
{
TestEvent += TestFunc;
TestStateGetSet = TestState.end;
}
void TestFunc(TestState a, TestState b)
{
Debug.Log(a);
Debug.Log(b);
}
}