2020-07-23 15:47:32 +08:00
|
|
|
extends StaticBody2D
|
|
|
|
|
|
|
|
class_name DoorStaticBody2D
|
|
|
|
|
|
|
|
onready var door_sprite : DoorSprite = get_parent()
|
|
|
|
|
|
|
|
func on_player_touched():
|
|
|
|
match door_sprite.door_type:
|
|
|
|
DoorSprite.DoorType.Yellow:
|
|
|
|
if GameArchiveManager.player_info.yellow_key <= 0:
|
|
|
|
return
|
|
|
|
GameArchiveManager.player_info.yellow_key -= 1
|
|
|
|
$"/root/Main/UI/KeyBackground/YellowKeyCountLabel".text = GameArchiveManager.player_info.yellow_key as String
|
|
|
|
DoorSprite.DoorType.Blue:
|
|
|
|
if GameArchiveManager.player_info.blue_key <= 0:
|
|
|
|
return
|
|
|
|
GameArchiveManager.player_info.blue_key -= 1
|
|
|
|
$"/root/Main/UI/KeyBackground/BlueKeyCountLabel".text = GameArchiveManager.player_info.blue_key as String
|
|
|
|
DoorSprite.DoorType.Red:
|
|
|
|
if GameArchiveManager.player_info.red_key <= 0:
|
|
|
|
return
|
|
|
|
GameArchiveManager.player_info.red_key -= 1
|
|
|
|
$"/root/Main/UI/KeyBackground/RedKeyCountLabel".text = GameArchiveManager.player_info.red_key as String
|
|
|
|
door_sprite.queue_free()
|
2020-07-23 22:12:08 +08:00
|
|
|
AffectAudioPlayer.play_door()
|
2020-07-23 15:47:32 +08:00
|
|
|
GameArchiveManager.add_used_item(door_sprite.get_path())
|