Skip to content

Commit

Permalink
fixed more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmunoz502 committed Oct 1, 2024
1 parent 64a72e9 commit 857b658
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions global/autoload/audio/audio_player/track_state.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ var _is_active: bool = false
###############


func _on_ready() -> void:
func on_ready() -> void:
await audio_player.ready
track = audio_player.tracks.get_node(NodePath(self.name))
track.volume_db = linear_to_db(0.0)
audio_player.master_volume_changed.connect(_on_master_volume_changed)


func _on_state_enter() -> void:
func on_state_enter() -> void:
print("entered state: %s" % self.name)
_is_active = true
var from_volume: float = 0.0
var to_volume: float = audio_player.master_volume
transition_volume(from_volume, to_volume)


func _on_state_exit() -> void:
func on_state_exit() -> void:
print("exited state: %s" % self.name)
_is_active = false
var from_volume: float = audio_player.master_volume
Expand Down
12 changes: 6 additions & 6 deletions scenes/component/state_machine/state_machine.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ var current: StateMachineState
func _ready() -> void:
for child in get_children():
states[child.name] = child
child._on_ready()
child.on_ready()

await owner.ready
transition_to(default_state.name)


func _input(event: InputEvent) -> void:
current._on_input(event)
current.on_input(event)


func _process(delta: float) -> void:
current._on_process(delta)
current.on_process(delta)


func _physics_process(delta: float) -> void:
current._on_physics_process(delta)
current.on_physics_process(delta)


#############
Expand All @@ -38,6 +38,6 @@ func _physics_process(delta: float) -> void:

func transition_to(state_name: StringName) -> void:
if current:
current._on_state_exit()
current.on_state_exit()
current = states[state_name]
current._on_state_enter()
current.on_state_enter()
12 changes: 6 additions & 6 deletions scenes/component/state_machine/state_machine_state.gd
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
class_name StateMachineState extends Node


func _on_ready() -> void:
func on_ready() -> void:
pass


func _on_process(_delta: float) -> void:
func on_process(_delta: float) -> void:
pass


func _on_physics_process(_delta: float) -> void:
func on_physics_process(_delta: float) -> void:
pass


func _on_input(_event: InputEvent) -> void:
func on_input(_event: InputEvent) -> void:
pass


func _on_state_enter() -> void:
func on_state_enter() -> void:
pass


func _on_state_exit() -> void:
func on_state_exit() -> void:
pass

0 comments on commit 857b658

Please sign in to comment.