Example #1
0
 public bool Equals(GameMasterBoard other)
 {
     return(other != null &&
            base.Equals(other) &&
            UncompletedBlueGoalsLocations.SequenceEqual(other.UncompletedBlueGoalsLocations) &&
            UncompletedRedGoalsLocations.SequenceEqual(other.UncompletedRedGoalsLocations) &&
            Pieces.SequenceEqual(other.Pieces));
 }
Example #2
0
        public void MarkGoalAsCompleted(GoalField goal)
        {
            switch (goal.Team)
            {
            case TeamColor.Blue:
                UncompletedBlueGoalsLocations.Remove(goal);
                break;

            case TeamColor.Red:
                UncompletedRedGoalsLocations.Remove(goal);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #3
0
        public override void ReadXml(XmlReader reader)
        {
            base.ReadXml(reader);
            ReadCollection(reader, Pieces, nameof(Pieces));

            if (reader.NodeType != XmlNodeType.EndElement)
            {
                var blueGoals = ReadCollection <Location>(reader, nameof(UncompletedBlueGoalsLocations), new[] { typeof(Location) });
                UncompletedBlueGoalsLocations.AddRange(blueGoals);

                var readGoals = ReadCollection <Location>(reader, nameof(UncompletedRedGoalsLocations), new[] { typeof(Location) });
                UncompletedRedGoalsLocations.AddRange(readGoals);
            }
            else
            {
                foreach (var field in Content)
                {
                    if (!(field is GoalField goalField) || goalField.Type != GoalFieldType.Goal)
                    {
                        continue;
                    }

                    switch (goalField.Team)
                    {
                    case TeamColor.Blue:
                        UncompletedBlueGoalsLocations.Add(goalField);
                        break;

                    case TeamColor.Red:
                        UncompletedRedGoalsLocations.Add(goalField);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }
            reader.ReadEndElement();
        }