Beispiel #1
0
        /// <summary>
        /// 改变Unit的朝向
        /// </summary>
        public void Turn(Vector3 target, float turnTime = 0.1f)
        {
            Quaternion quaternion = PositionHelper.GetVector3ToQuaternion(this.GetParent <Unit>().Position, target);

            this.To       = quaternion;
            this.From     = this.GetParent <Unit>().Rotation;
            this.t        = 0;
            this.TurnTime = turnTime;
        }
Beispiel #2
0
        public void TurnImmediately(Vector3 target)
        {
            Vector3 nowPos = this.GetParent <Unit>().Position;

            if (nowPos == target)
            {
                return;
            }

            Quaternion quaternion = PositionHelper.GetVector3ToQuaternion(this.GetParent <Unit>().Position, target);

            this.GetParent <Unit>().Rotation = quaternion;
        }