Пример #1
0
 private void Homing(GameTime gameTime)
 {
     if (FollowObject != null)
     {
         Direction = MathFunctions.ChangeDirection(gameTime, Direction, Position, FollowObject.Position, DegreeChange);
         Direction = MathFunctions.ScaleDirection(Direction);
     }
 }
Пример #2
0
        public void RotateTowardsPoint(GameTime gameTime, Vector2 startingPoint, Vector2 preferredPoint, float rotateSpeed)
        {
            if (startingPoint.Equals(preferredPoint))
            {
                return;
            }

            SetDirection(MathFunctions.ChangeDirection(gameTime, scaledDirection, startingPoint, preferredPoint, rotateSpeed));
        }
        private void UpdateFollowing(GameTime gameTime)
        {
            if (TurningSpeed == 0)
            {
                TurningSpeed = 1;
            }

            Direction = MathFunctions.ChangeDirection(gameTime, Direction, Position, FollowObject.Position, TurningSpeed);
            Direction = MathFunctions.ScaleDirection(Direction);
        }
        public override void Update(GameTime gameTime, GameObjectVertical obj)
        {
            obj.FindFollowObject();

            if (obj.FollowObject != null && obj.DisableFollowObject <= 0)
            {
                obj.Direction = MathFunctions.ChangeDirection(gameTime, obj.Direction, obj.Position, obj.FollowObject.Position, obj.TurningSpeed);
                obj.Direction = MathFunctions.ScaleDirection(obj.Direction);
            }
        }
 private void UpdateFollowObject(GameTime gameTime)
 {
     Direction = MathFunctions.ChangeDirection(gameTime, Direction, Position, player.Position, turningSpeed);
     Direction = MathFunctions.ScaleDirection(Direction);
 }