public void DestroyBoard(bool playSound = true) { if (_gameBoard == null) { return; } // Destroy the lattice grid _lattice.DestroyGrid(); // Destroy all objects in the game board var i = 0; foreach (var node in NodeMap.Values) { node.WaveOut(i++, NodeMap.Count, playSound: playSound); } foreach (var field in FieldMap.Fields) { field.Highlight(false); } foreach (Transform child in transform) { var node = child.gameObject.GetComponent <NodeView>(); var arc = child.gameObject.GetComponent <ArcView>(); var field = child.gameObject.GetComponent <FieldView>(); // Only destroy board pieces if (node != null) { _itemPool.Release(node, 3f); } else if (arc != null) { _itemPool.Release(arc, 3f); } else if (field != null) { _itemPool.Release(field, 3f); } } NodeMap.Clear(); ArcMap.Clear(); FieldMap.Clear(); _gameBoard = null; if (!playSound) { return; } // TODO: make configurable const float volume = 0.5f; _gameAudio.Play(GameClip.GameEnd, volume: volume); }
public void ClearAndIsEmptyTest() { FieldMap fieldmap = new FieldMap(); BooleanField field = new BooleanField(200, true); Assert.That(fieldmap.IsEmpty(), Is.EqualTo(true)); fieldmap.SetField(field); Assert.That(fieldmap.IsEmpty(), Is.EqualTo(false)); fieldmap.Clear(); Assert.That(fieldmap.IsEmpty(), Is.EqualTo(true)); Group g = new Group(100, 101); fieldmap.AddGroup(g); Assert.That(fieldmap.IsEmpty(), Is.EqualTo(false)); fieldmap.Clear(); Assert.That(fieldmap.IsEmpty(), Is.EqualTo(true)); }
public void Clear() { fieldMap.Clear(); }