23 lines
993 B
GDScript
23 lines
993 B
GDScript
extends TextureRect
|
|
tool
|
|
export(Constants.WEATHER) var weather = Constants.WEATHER.UNKNOWN setget set_weather
|
|
const images := {
|
|
Constants.WEATHER.CLOUDY: preload("res://assets/texture/weather_icons/weather3.png"),
|
|
Constants.WEATHER.FOGGY: preload("res://assets/texture/weather_icons/weather7.png"),
|
|
Constants.WEATHER.PARTLYCLOUDY: preload("res://assets/texture/weather_icons/weather2.png"),
|
|
Constants.WEATHER.RAINY: preload("res://assets/texture/weather_icons/weather4.png"),
|
|
Constants.WEATHER.SNOWY: preload("res://assets/texture/weather_icons/weather6.png"),
|
|
Constants.WEATHER.STORMY: preload("res://assets/texture/weather_icons/weather5.png"),
|
|
Constants.WEATHER.SUNNY: preload("res://assets/texture/weather_icons/weather1.png"),
|
|
Constants.WEATHER.UNKNOWN: preload("res://assets/texture/weather_icons/weather8.png"),
|
|
}
|
|
|
|
func _ready():
|
|
set_weather(weather)
|
|
|
|
func set_weather(new:int):
|
|
if !images.has(new):
|
|
new = Constants.WEATHER.UNKNOWN
|
|
weather = new
|
|
texture = images.get(new)
|