protected override void AddColour(CharacterColour colour) { if (IsComplete) { return; } Received.Add(colour); // If we have the correct number of elements in buffer then check combination if (Received.Count == combination.Length) { for (int i = 0; i < combination.Length; i++) { // Incorrect combination if (Received[i] != combination[i]) { // Clear the received buffer Received.Clear(); // Play a failure sound? return; } } // Combination was correct SetComplete(); } }
protected override void Dispose(bool disposing) { if (!IsDisposing) { if (disposing) { Stream.Dispose(); #if DEBUG Sended.Clear(); Received.Clear(); #endif } IsDisposing = true; } base.Dispose(disposing); }