/// <summary> /// Adds an item at the end of the collection /// </summary> /// <param name="item">Defines the item which is meant to be added</param> /// <exception cref="System.Exception">Thrown if this movement would be impossible</exception> public void Add(LayerMove item) { CubeFlag flag = item.Layer; foreach (LayerMove m in _moves) { flag |= m.Layer; } if (CubeFlagService.IsPossibleMove(flag)) { _moves.Add(item); } else { throw new Exception("Impossible movement"); } }