ajout du déblocage/évolutions des plantes (#89) et fix divers
This commit is contained in:
@@ -21,7 +21,6 @@ func _init():
|
||||
@export var truck_data : TruckData = TruckData.new()
|
||||
|
||||
func set_default_unlocked():
|
||||
unlocked_plant_types = all_plant_types()
|
||||
unlocked_plant_mutations = all_plant_mutations()
|
||||
unlocked_machines = all_machines()
|
||||
|
||||
@@ -39,6 +38,25 @@ func reset_all():
|
||||
reset_player()
|
||||
reset_truck()
|
||||
|
||||
unlocked_plant_types = []
|
||||
|
||||
func unlock_plant_type(new_plant_type : PlantType):
|
||||
if not is_plant_type_unlocked(new_plant_type):
|
||||
unlocked_plant_types.append(new_plant_type.duplicate_deep())
|
||||
|
||||
func get_locked_plant_types() -> Array[PlantType]:
|
||||
var locked_plant_type : Array[PlantType] = []
|
||||
|
||||
for pt in GameInfo.game_data.all_plant_types():
|
||||
if not is_plant_type_unlocked(pt):
|
||||
locked_plant_type.append(pt)
|
||||
|
||||
return locked_plant_type
|
||||
|
||||
func is_plant_type_unlocked(new_plant_type : PlantType):
|
||||
return unlocked_plant_types.find_custom(
|
||||
func (upt : PlantType): return new_plant_type.name == upt.name
|
||||
) != -1
|
||||
|
||||
|
||||
func all_plant_types() -> Array[PlantType]:
|
||||
|
||||
Reference in New Issue
Block a user