Early switch scripts working
This commit is contained in:
47
scripts/switch_interactandshoot.gd
Normal file
47
scripts/switch_interactandshoot.gd
Normal file
@@ -0,0 +1,47 @@
|
||||
extends Node3D
|
||||
|
||||
var switched_on
|
||||
|
||||
@export var default_setting : bool = false
|
||||
@export var toggle_enabled : bool = false
|
||||
@export var bullet_enabled : bool = true
|
||||
@export var timer_enabled : bool = false
|
||||
@export var timer_duration : float = 2.0
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
add_to_group("switch")
|
||||
add_to_group("interact")
|
||||
switched_on = default_setting
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func interact():
|
||||
print("switch hit")
|
||||
if toggle_enabled:
|
||||
if switched_on:
|
||||
switched_on = false
|
||||
else:
|
||||
switched_on = true
|
||||
else:
|
||||
print("switched on")
|
||||
switched_on = true
|
||||
|
||||
|
||||
func _on_static_body_3d_switch_hit() -> void:
|
||||
if bullet_enabled:
|
||||
print("switch hit")
|
||||
if toggle_enabled:
|
||||
if switched_on:
|
||||
switched_on = false
|
||||
else:
|
||||
print("switched on")
|
||||
switched_on = true
|
||||
else:
|
||||
print("switched on")
|
||||
switched_on = true
|
||||
|
||||
Reference in New Issue
Block a user