Reorganize file structure of project
This commit is contained in:
28
Entities/Characters/Player/Scripts/interact_scanner.gd
Normal file
28
Entities/Characters/Player/Scripts/interact_scanner.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends Area2D
|
||||
class_name InteractScanner
|
||||
|
||||
signal InteractionActionTriggered()
|
||||
|
||||
@export var parent: Node2D
|
||||
@export var direction_component: FacingDirectionComponent
|
||||
@export var disable_interactions := false
|
||||
|
||||
# Public Methods
|
||||
func OnDirectionChanged() -> void:
|
||||
var direction := direction_component.GetCurrentDirection()
|
||||
if direction == Enums.Directions.LEFT:
|
||||
parent.rotation = deg_to_rad(90)
|
||||
elif direction == Enums.Directions.RIGHT:
|
||||
parent.rotation = deg_to_rad(-90)
|
||||
elif direction == Enums.Directions.UP:
|
||||
parent.rotation = deg_to_rad(180)
|
||||
else:
|
||||
parent.rotation = deg_to_rad(0)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if disable_interactions:
|
||||
return
|
||||
if Input.is_action_just_pressed("player_interact"):
|
||||
InputManager.IgnoreAction("player_interact")
|
||||
InteractionActionTriggered.emit()
|
||||
Reference in New Issue
Block a user