示例#1
0
        public static float ComputeOrientation(float orientation, GsVector direction, float turnSpeed)
        {
            float desiredAngle = (float)Math.Atan2(direction.Y, direction.X);
            float difference   = GsMath.WrapAngle(desiredAngle - orientation);

            return(GsMath.WrapAngle(orientation + difference));
        }
 public override void Update(TimeSpan elapsed)
 {
     base.Update(elapsed);
     if (Level == MaxLevel)
     {
         Orientation = Environment.TickCount / 1000f;
         Orientation = GsMath.WrapAngle(Orientation);
     }
 }
示例#3
0
        public override void Update(TimeSpan elapsed)
        {
            // let the base do it's thing
            base.Update(elapsed);

            // spin around in a circle
            Orientation += ((float)elapsed.TotalSeconds * RadiansPerSecond);
            Orientation  = GsMath.WrapAngle(Orientation);
        }
        protected void UpdateVariables(float elapsedSeconds)
        {
            //mScale += elapsedSeconds * ScalesPerSecond;
            //Size = mOwnerBounds.Size * .5f * mScale;

            // spin the projectile
            Orientation += elapsedSeconds * RotationsPerSecond;
            Orientation  = GsMath.WrapAngle(Orientation);
        }
示例#5
0
        private void AdjustOrientation()
        {
            if (TargetCell == null)
            {
                Orientation = (DijkstraKey == DijkstraType.LeftToRight) ? 0f : GsMath.PiOver2;
            }
            else
            {
                float dx = TargetCell.X - X;
                float dy = TargetCell.Y - Y;

                float desiredAngle = (float)Math.Atan2(dy, dx);
                float difference   = GsMath.WrapAngle(desiredAngle - Orientation);
                Orientation = GsMath.WrapAngle(Orientation + difference);
            }
        }