''' ''' Defines and handles terrain definitions for a map. ''' Public Class Terrain #Region "Enums" ''' ''' A terrain type defined in the Terrain tag of a map. ''' Public Enum TerrainTypes Plain Sand Cave Rock TallGrass LongGrass PondWater SeaWater Underwater DistortionWorld Puddles Snow Magma PvPBattle End Enum #End Region #Region "Fields and Constants" Private _terrainType As TerrainTypes = TerrainTypes.Plain #End Region #Region "Properties" ''' ''' The terrain type of this Terrain instance. ''' Public Property TerrainType() As TerrainTypes Get Return Me._terrainType End Get Set(value As TerrainTypes) Me._terrainType = value End Set End Property #End Region #Region "Constructors" ''' ''' Creates a new instance of the Terrain class and sets an initial TerrainType. ''' ''' The TerrainType for this instance. Public Sub New(ByVal InitialTerrainType As TerrainTypes) Me._terrainType = InitialTerrainType End Sub #End Region #Region "Methods" ''' ''' Converts a Terrain name to the correct Terrain class instance. ''' ''' The Terrain name. Public Shared Function FromString(ByVal input As String) As Terrain.TerrainTypes Select Case input.ToLower() Case "plain" Return TerrainTypes.Plain Case "sand" Return TerrainTypes.Sand Case "cave" Return TerrainTypes.Cave Case "rock" Return TerrainTypes.Rock Case "tallgrass" Return TerrainTypes.TallGrass Case "longgrass" Return TerrainTypes.LongGrass Case "pondwater" Return TerrainTypes.PondWater Case "seawater" Return TerrainTypes.SeaWater Case "underwater" Return TerrainTypes.Underwater Case "distortionworld" Return TerrainTypes.DistortionWorld Case "puddles" Return TerrainTypes.Puddles Case "snow" Return TerrainTypes.Snow Case "magma" Return TerrainTypes.Magma Case "pvp" Return TerrainTypes.PvPBattle End Select ' Default terrain: Logger.Log(Logger.LogTypes.Warning, "Terrain.vb: Invalid terrain name: """ & input & """. Returning ""Plains"".") Return TerrainTypes.Plain End Function #End Region ''' ''' Test for TerrainType equality. ''' ''' The first Terrain instance. ''' The second Terrain instance. Public Shared Operator =(ByVal value1 As Terrain, ByVal value2 As Terrain) As Boolean Return value1.TerrainType = value2.TerrainType End Operator ''' ''' Test for TerrainType inequality. ''' ''' The first Terrain instance. ''' The second Terrain instance. Public Shared Operator <>(ByVal value1 As Terrain, ByVal value2 As Terrain) As Boolean Return Not value1 = value2 End Operator End Class