extends Node2D enum TileType { None, Sand, Grass } var TileTypeFromString = { "None": TileType.None, "Sand": TileType.Sand, "Grass": TileType.Grass } var HexPoints = null var HexColors = [] export(Vector2) var hex_scale = Vector2(1, 1) setget set_hex_scale # Called when the node enters the scene tree for the first time. func _ready(): print ("Initialized") set_hex_scale(Vector2(Globals.hex_size,Globals.hex_size)) func set_hex_scale(scale): hex_scale = scale HexPoints = PoolVector2Array() var NoneColors = PoolColorArray() var SandColors = PoolColorArray() var GrassColors = PoolColorArray() for i in range (7): var angle = (60 * i) * PI / 180 HexPoints.append(Vector2(cos(angle), sin(angle)) * hex_scale.x / 2) NoneColors.append("#885555") SandColors.append("#ffa106") GrassColors.append("#4b9635") HexColors = { TileType.None: NoneColors, TileType.Sand: SandColors, TileType.Grass: GrassColors } func get_tile_color (type_name: String): match type_name: "None": return HexColors[TileType.None] "Sand": return HexColors[TileType.Sand] "Grass": return HexColors[TileType.Grass] _ : return null