private void ClearRunner() { if (_runner != null) { _runner.Exit(); _runner = null; } }
protected override void OnEnter() { long now = SystemTime.GetTime(); model.SetAnimator(AnimatorType.IS_RUNNING, AnimatorControllerParameterType.Bool, 1); LuaTable tb = machine.GetRuntimeData <LuaTable>(CpxState.TEMP_DATA); Vector3 np; if (!tb.TryGet("position", out np)) { GlobalLogger.LogError(string.Format("{0} require position", this)); _status = CompStatus.COMPLETE; return; } Vector3 dest; if (!tb.TryGet("forcast", out dest)) { GlobalLogger.LogError(string.Format("{0} require forcast", this)); _status = CompStatus.COMPLETE; return; } Vector3 mp = model.position; Vector3 gap = np - mp; float offset = gap.magnitude; if (offset > cpx.threshold) { model.MoveTo(np); mp = np; } _path[0] = mp; _path[1] = np; _path[2] = dest; _runner = MoveRunner_Path3D.Get(); _runner.Set(model, this); _runner.Preset(_path, now, 0); _runner.updateAnim = false; _runner.Enter(); _status = CompStatus.RUNING; }