Example #1
0
 /// <summary>
 /// Applies definition to square.
 /// </summary>
 /// <param name="definition">The square definition to apply from.</param>
 public void FromDefinition(SquareDefinition definition)
 {
     /* check if supported */
     if (this.SupportsDefinition(definition))
     {
         this.Type = definition.Type;
     }
 }
Example #2
0
 /// <summary>
 /// Checks whether given definition is supported by this square.
 /// </summary>
 /// <param name="definition">The definition to check.</param>
 /// <returns>True if definition is supported, otherwise false.</returns>
 protected override bool SupportsDefinition(SquareDefinition definition)
 {
     return (definition != null) && (
         (definition.Type.Equals(SquareType.WaterSourceDown)) ||
         (definition.Type.Equals(SquareType.WaterSourceLeft)) ||
         (definition.Type.Equals(SquareType.WaterSourceRight)) ||
         (definition.Type.Equals(SquareType.WaterSourceUp))
     );
 }
Example #3
0
 /// <summary>
 /// Checks whether given definition is supported by this square.
 /// </summary>
 /// <param name="definition">The definition to check.</param>
 /// <returns>True if definition is supported, otherwise false.</returns>
 protected override bool SupportsDefinition(SquareDefinition definition)
 {
     return (definition != null) && (
         (definition.Type.Equals(SquareType.StraightHorizontal)) ||
         (definition.Type.Equals(SquareType.StraightVertical))
     );
 }
Example #4
0
 /// <summary>
 /// Checks whether given definition is supported by this square.
 /// </summary>
 /// <param name="definition">The definition to check.</param>
 /// <returns>True if definition is supported, otherwise false.</returns>
 protected override bool SupportsDefinition(SquareDefinition definition)
 {
     return (definition != null) && (
         (definition.Type.Equals(SquareType.EdgeDownLeft)) ||
         (definition.Type.Equals(SquareType.EdgeDownRight)) ||
         (definition.Type.Equals(SquareType.EdgeUpLeft)) ||
         (definition.Type.Equals(SquareType.EdgeUpRight))
     );
 }
Example #5
0
 /// <summary>
 /// Checks whether given definition is supported by this square.
 /// </summary>
 /// <param name="definition">The definition to check.</param>
 /// <returns>True if definition is supported, otherwise false.</returns>
 protected abstract bool SupportsDefinition(SquareDefinition definition);
Example #6
0
 /// <summary>
 /// Checks whether given definition is supported by this square.
 /// </summary>
 /// <param name="definition">The definition to check.</param>
 /// <returns>True if definition is supported, otherwise false.</returns>
 protected override bool SupportsDefinition(SquareDefinition definition)
 {
     return (definition != null) && (definition.Type.Equals(SquareType.Empty));
 }
 /// <summary>
 /// Creates a new instance of SquareMapItemDefinition class.
 /// </summary>
 /// <param name="position">The position of square map item.</param>
 /// <param name="square">The square definition for square map item.</param>
 public SquareMapItemDefinition(Position position, SquareDefinition square)
 {
     this.position = position;
     this.square = square;
 }
Example #8
0
        /// <summary>
        /// Creates square.
        /// </summary>
        /// <param name="definition">The square definition used to create square.</param>
        /// <returns>Newly created square if possible, otherwise null.</returns>
        public ISquareElement CreateSquare(SquareDefinition definition)
        {
            if (definition != null)
            {
                return this.CreateSquare(definition.Type);
            }

            return null;
        }