创建动作调度器,判断当前处于什么动作,为后续做准备
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- namespace RPG.Core
- {
- public class ActionScheduler : MonoBehaviour
- {
- MonoBehaviour currentAction;
- public void StartAction(MonoBehaviour action)
- {
- if (currentAction == action) return;//如果新操作与当前操作相同,则不执行任何操作
- if (currentAction != null)//如果有新的操作,请打印取消消息
- {
- print("取消" + currentAction);
- }
-
- currentAction = action;//将新操作设置为当前操作
- }
- }
- }
复制代码
|