Пример #1
0
        public virtual void CheckTraining(Mobile from, Mobile target)
        {
            if (from == null || from.Deleted || target == null || target.Deleted)
            {
                if (TrainingTimer != null)
                {
                    TrainingTimer.Stop();
                    TrainingTimer = null;
                }

                return;
            }

            if (TrainingTimer == null)
            {
                TrainingLocation = from.Location;

                TrainingTimer = PollTimer.CreateInstance(
                    TimeSpan.FromSeconds(1.0),
                    () =>
                {
                    if (from.Location != TrainingLocation)
                    {
                        TrainingTimer.Stop();
                        TrainingTimer = null;
                        return;
                    }

                    BeginThrow(from, target);
                });
            }
            else if (from.Location != TrainingLocation)
            {
                TrainingTimer.Stop();
                TrainingTimer = null;
            }
        }