sfx de minage et récolte fonctionnels #164
This commit is contained in:
@@ -34,20 +34,22 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool:
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||||
AudioManager.play_sfx("Rocks")
|
|
||||||
for area in zone.get_affected_areas():
|
for area in zone.get_affected_areas():
|
||||||
if area and area is Plant:
|
if area and area is Plant:
|
||||||
harvest(area, player)
|
harvest(area, player)
|
||||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||||
|
AudioManager.play_sfx("Harvest")
|
||||||
|
|
||||||
var bodies = zone.area.get_overlapping_bodies()
|
var bodies = zone.area.get_overlapping_bodies()
|
||||||
var rock_layers = bodies.filter(func (b) : return b is RockLayer)
|
var rock_layers = bodies.filter(func (b) : return b is RockLayer)
|
||||||
for rock_layer in rock_layers:
|
if len(rock_layers):
|
||||||
player.region.dig_rocks(zone.get_tiles())
|
player.region.dig_rocks(zone.get_tiles())
|
||||||
|
|
||||||
var particles := (DIG_PARTICLES.instantiate() as DigParticleEmmitter)
|
var particles := (DIG_PARTICLES.instantiate() as DigParticleEmmitter)
|
||||||
player.region.add_child(particles)
|
player.region.add_child(particles)
|
||||||
particles.global_position = zone.get_global_position()
|
particles.global_position = zone.get_global_position()
|
||||||
particles.emit()
|
particles.emit()
|
||||||
|
AudioManager.play_sfx("Mining")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user