public Tuple <bool, SpecialField> IsSpecialField(int Field) { bool hasField = false; SpecialField specialField = null; foreach (SpecialField special in SpecialFields) { if (special.FieldNumber == Field) { hasField = true; specialField = special; } } return(Tuple.Create(hasField, specialField)); }
private void specialFieldAction(int playerPosition) { Tuple <bool, SpecialField> tuple = gameLogics.IsSpecialField(currentPosition); if (tuple.Item1) { SpecialField field = tuple.Item2; switch (field.Command) { case SpecialField.CommandOptions.GoTO: //moveGoosePosition(playerColour, currentPosition, field.FieldNumber); switch (playerPosition) { case 1: currentPositionPlayer1 = field.GoToFIeld; break; case 2: currentPositionPlayer2 = field.GoToFIeld; break; case 3: currentPositionPlayer3 = field.GoToFIeld; break; case 4: currentPositionPlayer4 = field.GoToFIeld; break; } break; case SpecialField.CommandOptions.SkipTurn: PlayNextTrun = false; break; case SpecialField.CommandOptions.Wait: Wait = true; break; case SpecialField.CommandOptions.End: break; } } }
private void ActionOfField(SpecialField special) { if (special.Command == SpecialField.CommandOptions.GoTO) { Field = special.GoToFIeld; } else if (special.Command == SpecialField.CommandOptions.SkipTurn) { PlayNextTrun = false; } else if (special.Command == SpecialField.CommandOptions.Wait) { PlayNextTrun = false; Wait = true; } else if (special.Command == SpecialField.CommandOptions.End) { hasWon = true; } }