You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
981 B

/****************************************************
StateMgr.cs
Plane
: 1785275942@qq.com
2019/03/15 9:08
*****************************************************/
using UnityEngine;
using System.Collections.Generic;
public class StateMgr : MonoBehaviour {
private Dictionary<AniState, IState> fsm = new Dictionary<AniState, IState>();
public void Init() {
//fsm.Add(AniState.Born, new StateBorn());
}
public void ChangeStatus(EntityBase entity, AniState targetState, params object[] args) {
if (entity.currentAniState == targetState) {
return;
}
if (fsm.ContainsKey(targetState)) {
if (entity.currentAniState != AniState.None) {
fsm[entity.currentAniState].Exit(entity, args);
}
fsm[targetState].Enter(entity, args);
fsm[targetState].Process(entity, args);
}
}
}