private EAction currentState; //現在の状態 void Start() { skillManager = new SkillManager(skillModels); currentAction = ActionStateFactory.CreateActionState(EAction.Idle); currentAction.StartProcess(EAction.Idle); currentState = EAction.Idle; }
/// <summary> /// 状態を切り替え /// </summary> private void ChangeActionState(EAction actionType) { EAction previous = currentState; //現在の状態を記録 currentState = actionType; //新状態を指定 currentAction.EndProcess(); //現在の行動を終了処理 currentAction = ActionStateFactory.CreateActionState(currentState); //新行動を指定 currentAction.StartProcess(previous); //行動を初期化処理 }