コード例 #1
0
        public JourneyStepPairs <T> AdvanceJourney(GameCourseModel model)
        {
            Assert.IsTrue(_journeySteps.Any() || _currentStep != null, "There are no more steps to do");
            IJourneyStep <T> nextStep = null;

            if (_journeySteps.Any())
            {
                nextStep = _journeySteps.Dequeue();
            }
            var steps = new JourneyStepPairs <T>()
            {
                PreviousStep = _currentStep,
                NextStep     = nextStep
            };

            _currentStep = nextStep;
            if (_currentStep != null)
            {
                _currentAnimation = _currentStep.CreateAnimation(model, _locomotionTarget);
                _currentAnimation.StartAnimation();

                if (!_journeySteps.Any())
                {
                    _currentStep.GenerateFinalSteps(model, _locomotionTarget).ForEach(c => _journeySteps.Enqueue(c));
                }
            }
            return(steps);
        }
コード例 #2
0
 private IJourneyStep <UnitModelComponent> GetInternalStep(GameCourseModel model)
 {
     if (_step == null)
     {
         if (model.HasTileAt(To) && !model.HasUnitAt(To))
         {
             _step = new JourneyMotion()
             {
                 To = To
             };
         }
         else
         {
             _step = new JourneyDeath();
         }
     }
     return(_step);
 }