// ***********************************************************************
// Assembly : Unity
// Author : Kimch
// Created : 2017-1-1
//
// Last Modified By : Kimch
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
namespace G
{
using UnityEngine;
public class GameFsm : MonoBehaviour
{
private static GameFsm _Instance;
public static GameFsm Instance => _Instance;
private F.Fsm.IFsm _fsm;
public void SendEvent(object sender, int eventId, object data)
{
_fsm.SendEvent(sender, eventId, data);
}
#region Unity
private void Awake()
{
_Instance = this;
}
// Use this for initialization
private void Start()
{
//_Instance = this;
_fsm = KFramework.FsmManager.CreateFsm(this,
new GameStateInitial(),//初始化游戏 检查更新
new GameStateLogin(),//登录状态
new GameStateWorld());//游戏逻辑
_fsm.Start();
}
private void OnDestroy()
{
if (_fsm != null)
{
KFramework.FsmManager.DestroyFsm(_fsm);
}
}
#endregion
}
}