/// <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; } }
/// <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)) ); }
/// <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)) ); }
/// <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)) ); }
/// <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);
/// <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; }
/// <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; }