#44 changement de la méthode d'interaction et d'utilisation du joueur pour une plus grande liberté de la souris
This commit is contained in:
@@ -13,14 +13,23 @@ class_name Seed
|
||||
func _init(_plant_type : PlantType = null):
|
||||
plant_type = _plant_type
|
||||
|
||||
func generate_action_area(player : Player) -> ActionArea:
|
||||
return ActionArea.new(
|
||||
player,
|
||||
10
|
||||
)
|
||||
|
||||
func use_text(_player) -> String:
|
||||
return "Plant " + plant_type.name
|
||||
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
return not player.planet.is_there_contamination(player.global_position)
|
||||
return not player.planet.is_there_contamination(player.action_area.global_position)
|
||||
|
||||
func use(player : Player) -> bool:
|
||||
if not can_use(player):
|
||||
return false
|
||||
player.play_sfx("dig")
|
||||
return player.planet.plant(plant_type, player.global_position)
|
||||
return player.planet.plant(plant_type, player.action_area.global_position)
|
||||
|
||||
@@ -3,6 +3,9 @@ class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
|
||||
func use_text(_player) -> String:
|
||||
return "Dig"
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
var areas = player.action_area.get_overlapping_areas()
|
||||
for area in areas :
|
||||
|
||||
Reference in New Issue
Block a user