//only main thread private void EmitMoveEvent(NavAgent agent, bool isFound, AgentRemote enemy) { if (isFound) { MovementListener.Move( agent.GetMovePath(), agent.GetTimes(), agent.CurrentPosition, agent.Remote, enemy); } }
public void Dead() { Debugger.Log(AgentID + ": dead called from animation"); unitSubject.Remove(observer); deathEvents?.Invoke(this); deathEvents = null; FixedMove.Stop(); NavAgent?.Stop(); Unbinding(); unitSubject.Remove(observer); unitSubject.ObserverPooling.Release(observer); }
public void SwitchToAgent(NavAgent agent) { CurrentAgent = agent; }
public void FindPathDone_OnlyMainThread(NavAgent agent, bool found) { ThreadHelper.MainThreadInvoke(() => EmitMoveEvent(agent, found, agent.TargetEnemy)); }
public void MoveAgent(NavAgent agent, Vector3Int start, Vector3Int end, AgentRemote enemy) { agent.AsyncStartMove(start, end, enemy); }