コード例 #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));
        }
コード例 #3
0
        private void UpdateFollowing(GameTime gameTime)
        {
            if (TurningSpeed == 0)
            {
                TurningSpeed = 1;
            }

            Direction = MathFunctions.ChangeDirection(gameTime, Direction, Position, FollowObject.Position, TurningSpeed);
            Direction = MathFunctions.ScaleDirection(Direction);
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 private void UpdateFollowObject(GameTime gameTime)
 {
     Direction = MathFunctions.ChangeDirection(gameTime, Direction, Position, player.Position, 1);
     Direction = MathFunctions.ScaleDirection(Direction);
 }