using UnityEngine;
namespace SK.Framework
{
public abstract class SwitchableObject : MonoBehaviour, ISwitchableObject
{
//默认设为关闭状态
[SerializeField] protected SwitchState state = SwitchState.Close;
///
/// 当前状态
///
public SwitchState State { get { return state; } }
///
/// 切换 若为打开状态则关闭 若为关闭状态则打开
///
public void Switch()
{
switch (State)
{
case SwitchState.Open: Close(); break;
case SwitchState.Close: Open(); break;
}
}
///
/// 开门
///
public abstract void Open();
///
/// 关门
///
public abstract void Close();
}
}