Ejemplo n.º 1
0
 private GridChain.enumDirectionType CombineDirections(GridChain.enumDirectionType lastDirection, GridChain.enumDirectionType newDirection)
 {
     if (lastDirection != GridChain.enumDirectionType.Straight)
     {
         return(lastDirection);
     }
     else
     {
         return(newDirection);
     }
 }
Ejemplo n.º 2
0
 public void GenerateChain(int rowStart, int rowEnd, int nextStart, GridChain.enumDirectionType direction)
 {
     for (int index = 0; index <= rowEnd - rowStart; index++)
     {
         int fromSpot = rowStart + index;
         int toSpot   = nextStart + index;
         Chain.AddGridChain(new GridChain()
         {
             Direction      = direction,
             StopNumberFrom = fromSpot,
             StopNumberTo   = toSpot
         });
     }
 }
Ejemplo n.º 3
0
        private bool CanMoveDirection(GridChain.enumDirectionType lastDirection, GridChain.enumDirectionType newDirection)
        {
            switch (lastDirection)
            {
            case GridChain.enumDirectionType.Inward:
                return(newDirection != GridChain.enumDirectionType.Outward);

            case GridChain.enumDirectionType.Outward:
                return(newDirection != GridChain.enumDirectionType.Inward);

            default:
                return(true);
            }
        }
Ejemplo n.º 4
0
        public void AddRoll(int startSpot, int dieNum, int endSpot, uint overshootTurnCount, uint overshootCount, GridChain.enumDirectionType direction, bool doesCrossFinish)
        {
            if (!_rollBySpotByDie.ContainsKey(startSpot))
            {
                _rollBySpotByDie.Add(startSpot, new Dictionary <int, List <Roll> >());
            }
            if (!_rollBySpotByDie[startSpot].ContainsKey(dieNum))
            {
                _rollBySpotByDie[startSpot].Add(dieNum, new List <Roll>());
            }
            Roll roll = new Roll()
            {
                Direction          = direction,
                DoesCrossFinish    = doesCrossFinish,
                EndSpot            = endSpot,
                OvershootCount     = overshootCount,
                OvershootTurnCount = overshootTurnCount,
                StartSpot          = startSpot
            };

            _rollBySpotByDie[startSpot][dieNum].Add(roll);
            _rolls.Add(roll);
        }