Exemplo n.º 1
0
        public static void FaceAngle(float angle)
        {
            float face;

            if (LazyMath.NegativeAngle(angle - ObjectManager.MyPlayer.Facing) < Math.PI)
            {
                face = LazyMath.NegativeAngle(angle - ObjectManager.MyPlayer.Facing);
                bool moving = ObjectManager.MyPlayer.IsMoving;
                if (face > 1)
                {
                    MoveHelper.ReleaseKeys();
                    moving = false;
                }
                FaceHorizontalWithTimer(face, "Left", moving);
            }
            else
            {
                face = LazyMath.NegativeAngle(ObjectManager.MyPlayer.Facing - angle);
                bool moving = ObjectManager.MyPlayer.IsMoving;
                if (face > 1)
                {
                    MoveHelper.ReleaseKeys();
                    moving = false;
                }
                FaceHorizontalWithTimer(face, "Right", moving);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///   让打架赛车面朝制定目标
        /// </summary>
        /// <param name = "打架赛车的PUnit">The pos.</param>
        /// <returns></returns>
        public void MFace(PUnit mObj)
        {
            float face;

            if (LazyMath.NegativeAngle(AngleHorizontal - mObj.Facing) < Math.PI)
            {
                face = LazyMath.NegativeAngle(AngleHorizontal - mObj.Facing);

                bool moving = mObj.IsMoving;
                if (face > 1)
                {
                    MoveHelper.ReleaseKeys();
                    moving = false;
                }
                FaceHorizontalWithTimer(face, "Left", moving);
            }
            else
            {
                face = LazyMath.NegativeAngle(mObj.Facing - AngleHorizontal);

                bool moving = mObj.IsMoving;
                if (face > 1)
                {
                    MoveHelper.ReleaseKeys();
                    moving = false;
                }
                FaceHorizontalWithTimer(face, "Right", moving);
            }
        }