16 lines
348 B
GDScript
16 lines
348 B
GDScript
class_name Guncase
|
|
extends StaticBody3D
|
|
|
|
var held: bool = false
|
|
|
|
func _ready() -> void:
|
|
if ($Area3D as Area3D).body_entered.connect(_on_body_entered):
|
|
pass
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body is Player:
|
|
if held:
|
|
if (body as Player).carrying_gun:
|
|
(body as Player).gun_chance()
|
|
else:
|
|
(body as Player).gun_chance()
|