meat_madness_redux/godot/player/PlatformMechanics.gd

20 lines
664 B
GDScript

extends Node
onready var global_event_bus = get_node("/root/GlobalEventBus")
var sink_counter = 0
export var SINK_BLOCK_SLOWDOWN_AMOUNT = Vector3(0.7, 0.1, 0.7)
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(SINK_BLOCK_SLOWDOWN_AMOUNT)
sink_counter += 1
func on_player_exited_meat_sink():
sink_counter -= 1
if sink_counter == 0:
$"../OnFootPhysics".decrease_velocity_factor(SINK_BLOCK_SLOWDOWN_AMOUNT)