Exemplo n.º 1
0
        public void Equals_ShouldReturnFalse_WhenMovementTypesAreNotEqual()
        {
            var type1 = new TerrainType(1, "Type");
            var type2 = new TerrainType(2, "Type");
            var type3 = new TerrainType(1, "Some other type");

            Assert.That(type1.Equals(type2), Is.False);
            Assert.That(type1.Equals(type3), Is.False);
            Assert.That(type1.Equals(null), Is.False);
        }
Exemplo n.º 2
0
        public void Equals_ShouldReturnTrue_WhenMovementTypesAreEqual()
        {
            var type1 = new TerrainType(1, "Type");
            var type2 = new TerrainType(1, "Type");

            Assert.That(type1.Equals(type2), Is.True);
        }
Exemplo n.º 3
0
        /// Adds a specified Marker to the tile.
        /// </summary>
        /// <param name="type">The type of Marker to add.</param>
        public void AddMarker(IMarker marker)
        {
            if ((!markers.Any() && defaultTerrainType.Equals(TerrainType.Blocking)) ||
                markers.Any() && markers.Peek().GetTerrainType.Equals(TerrainType.Blocking))
            {
                if (!marker.GetType().Equals(typeof(ClearMarker)) && !marker.GetType().Equals(typeof(DebrisMarker)))
                {
                    throw new InvalidOperationException("A " + marker.GetName() + " marker cannot be placed on Blocking terrain.");
                }
            }

            markers.Push(marker);
        }