Esempio n. 1
0
        private void Follow(double lastTick)
        {
            followTimer.Update(lastTick);
            if (!followTimer.HasElapsed)
            {
                return;
            }

            Player owner = GetVisible <Player>(OwnerGuid);

            if (owner == null)
            {
                // this shouldn't happen, log it anyway
                log.Error($"VanityPet {Guid} has lost it's owner {OwnerGuid}!");
                RemoveFromMap();
                return;
            }

            // only recalculate the path to owner if distance is significant
            float distance = owner.Position.GetDistance(Position);

            if (distance < FollowMinRecalculateDistance)
            {
                return;
            }

            MovementManager.Follow(owner, FollowDistance);

            followTimer.Reset();
        }