Added underscore to unpublic functions names

This commit is contained in:
2024-09-09 14:53:32 +03:00
parent 5581aed215
commit 18b9c4a63e
3 changed files with 41 additions and 42 deletions
+21 -22
View File
@@ -28,10 +28,10 @@ signal closed()
func _ready() -> void:
play_animation()
_play_animation()
func play_animation() -> void:
func _play_animation() -> void:
var animation : String = "%s_%s" % [
ANIMATIONS_BY_TYPE[type],
ANIMATIONS_BY_STATE[state]
@@ -39,36 +39,35 @@ func play_animation() -> void:
$AnimatedSprite2D.play(animation)
func _on_animated_sprite_2d_animation_finished() -> void:
match state:
DoorState.CLOSING:
state = DoorState.CLOSED
$CollisionShape2D.disabled = false
_play_animation()
DoorState.OPENING:
state = DoorState.OPENED
$CollisionShape2D.disabled = true
_play_animation()
DoorState.CLOSED:
closed.emit()
DoorState.OPENED:
opened.emit()
func open() -> void:
if state != DoorState.CLOSED:
print("Door in state '%s' can't be opened" % DoorState.find_key(state))
return
state = DoorState.OPENING
play_animation()
_play_animation()
func close():
if state != DoorState.OPENED:
print("Door in state '%s' can't be closed" % DoorState.find_key(state))
return
state = DoorState.CLOSING
play_animation()
func _on_animated_sprite_2d_animation_finished() -> void:
match state:
DoorState.CLOSING:
state = DoorState.CLOSED
$CollisionShape2D.disabled = false
play_animation()
DoorState.OPENING:
state = DoorState.OPENED
$CollisionShape2D.disabled = true
play_animation()
DoorState.CLOSED:
closed.emit()
DoorState.OPENED:
opened.emit()
_play_animation()