extends Node enum TileType { None, Sand, 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(): set_hex_scale(Vector2(32,32)) 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("#555555") 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