internal void MoveTo(Field pFields, bool pJump) { if (pJump) { Position = pFields.Index; PositionField.onMoveOn(this); } else { Position = (ushort)((Position + 1) % (GameBoard.FieldCount)); while (!PositionField.Equals(pFields)) { PositionField.onMoveOver(this); Position = (ushort)((Position + 1) % (GameBoard.FieldCount)); } PositionField.onMoveOn(this); } }
internal void OnMove() { var diceRoll = onRollDice(); if (diceRoll.IsDoubles) { DoublesCount += 1; } // Doubles Limit? if (DoublesCount >= GameBoard.Settings.MAX_DOUBLES) { NextAction.Clear(); NextAction.Enqueue(eActionType.JumpToJail); RaiseDoublesLimit(); } else { // Move over every field in path, an move on the last // TODO: Should call MoveTo with overload for (var i = 1; i < diceRoll.DiceSum; i++) { Position = (ushort)((Position + 1) % (GameBoard.FieldCount)); GameBoard.GetField(Position).onMoveOver(this); } Position = (ushort)((Position + 1) % GameBoard.FieldCount); PositionField.onMoveOn(this); if (IsPlayering && (diceRoll.IsDoubles) && this.Position != GameBoard.JailField.Index) { // Doubles Limit no reached, so add another move NextAction.Enqueue(eActionType.Move); // TODO: AddMove needs own event RaiseChance(eActionType.AddMove, new object[] { diceRoll }); } } }