meat_madness_redux/godot/player/PlatformMechanics.gd

19 lines
623 B
GDScript

extends Node
onready var global_event_bus = get_node("/root/GlobalEventBus")
var sink_counter = 0
func _ready():
global_event_bus.connect("player_entered_meat_sink", self, "on_player_enter_meat_sink")
global_event_bus.connect("player_exited_meat_sink", self, "on_player_exited_meat_sink")
func on_player_enter_meat_sink():
if sink_counter == 0:
$"../OnFootPhysics".increase_velocity_factor(Util.meat_sink_parameters.sink_factor)
sink_counter += 1
func on_player_exited_meat_sink():
sink_counter -= 1
if sink_counter == 0:
$"../OnFootPhysics".decrease_velocity_factor(Util.meat_sink_parameters.sink_factor)