32 lines
734 B
GDScript
32 lines
734 B
GDScript
extends Node
|
|
|
|
class_name LevelData
|
|
|
|
static var state : LevelStates = LevelStates.NotInGame
|
|
static var sun_count : float
|
|
|
|
var hotbar_seedpackets : Array[SeedpacketResource]
|
|
|
|
func _ready() -> void:
|
|
LevelEventBus.packet_selected.connect(on_seedpacket_clicked)
|
|
|
|
func on_seedpacket_clicked(seedpacket : SeedpacketResource):
|
|
if hotbar_seedpackets.has(seedpacket):
|
|
hotbar_seedpackets.erase(seedpacket)
|
|
else:
|
|
hotbar_seedpackets.append(seedpacket)
|
|
LevelEventBus.hotbar_packets_update.emit(hotbar_seedpackets)
|
|
|
|
## Possible states of level
|
|
enum LevelStates {
|
|
## The game is during plant pick stage
|
|
PlantPick,
|
|
## The game is not yet started
|
|
Pregame,
|
|
## Game started
|
|
Game,
|
|
## Game ended
|
|
Postgame,
|
|
## Not in a level,
|
|
NotInGame
|
|
}
|