je sais pas trop
This commit is contained in:
25
script/benitier.gd
Normal file
25
script/benitier.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends Node3D
|
||||
|
||||
var in_player:bool = false
|
||||
var player: CharacterBody3D = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if (in_player and Input.is_action_just_pressed("interact")):
|
||||
player.call("drink")
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body: Node3D) -> void:
|
||||
if (body is CharacterBody3D):
|
||||
in_player = true
|
||||
player = body
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body: Node3D) -> void:
|
||||
if (body is CharacterBody3D):
|
||||
in_player = false
|
||||
Reference in New Issue
Block a user