float counter; //计数器 public static MoveMonsterAction GetSSAction(float speed) { MoveMonsterAction action = ScriptableObject.CreateInstance <MoveMonsterAction>(); action.speed = speed; return(action); }
//巡逻 public void MoveMonster(GameObject monster, float speed) { MonsterManager monsterManager = monster.GetComponent <MonsterManager>(); if (monsterManager == null) { return; } if (!monsterManager.moveable) { monsterManager.moveable = true; monsterAction = MoveMonsterAction.GetSSAction(speed); RunAction(monster, monsterAction, this); } }