internal void Over() { foreach (GemController participant in Participants) { participant.RemovePossibleMove(this, Role.Participant); } Participants.Clear(); key.RemovePossibleMove(this, Role.Key); key = null; if (OnOver != null) { OnOver(this); } }
internal void RemoveParticipant(GemController participant) { if (!Participants.Contains(participant)) { return; } GemController[] relatedParticipants = GetRelatedParticipant(participant); Participants.Remove(participant); participant.RemovePossibleMove(this, Role.Participant); if (relatedParticipants != null) { foreach (GemController rp in relatedParticipants) { Participants.Remove(rp); rp.RemovePossibleMove(this, Role.Participant); } } IsValid = CheckValidity(); if (!IsValid) { Over(); } }