コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public bool IsInPos(Vector3 target, float k) => BaseMathUtil.Approximately(SelfUnit.Pos, target, k);
コード例 #3
0
 public bool IsInDestination() => BaseMathUtil.Approximately(Destination, SelfUnit.Pos);