Untested PickupableItem
This commit is contained in:
parent
a2c062e8bb
commit
63e87e86d5
19 changed files with 200 additions and 17 deletions
26
base/scripts/interactive/interactive_object.gd
Normal file
26
base/scripts/interactive/interactive_object.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends Sprite3D
|
||||
|
||||
class_name InteractiveObject
|
||||
|
||||
var player: Player = null
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if player == null:
|
||||
return
|
||||
if Input.is_action_just_pressed('interact'):
|
||||
_interact(player)
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if body is Player:
|
||||
player = body
|
||||
|
||||
func _on_body_exited(body: Node3D) -> void:
|
||||
if body is Player:
|
||||
player = null
|
||||
|
||||
## Invoked when interact action was used when player is in object's area
|
||||
func _interact(_player: Player) -> void:
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue