public override void OnUpdate() { base.OnUpdate(); if (SelfBaseUnit != null) { //位置变化记录 LastPos = SelfUnit.Pos; LastRot = SelfUnit.Rot; //执行旋转 if (!IsLockRotation) { if (!IsMoving) { SelfBaseUnit.Rot = Quaternion.Slerp(SelfBaseUnit.Rot, NewQuateration, Time.smoothDeltaTime * RealRotSpeed); } else { NewQuateration = SelfBaseUnit.Rot; } } //使用携程 if (UseFollowCoroutine) { } else { OnFollowPathUpdate(); } StateMachine?.OnUpdate(); //位置变化记录 IsPositionChange = !BaseMathUtil.Approximately(LastPos, SelfUnit.Pos); IsRotationChange = LastRot != SelfUnit.Rot; } }
public bool IsInPos(Vector3 target, float k) => BaseMathUtil.Approximately(SelfUnit.Pos, target, k);
public bool IsInDestination() => BaseMathUtil.Approximately(Destination, SelfUnit.Pos);