2025-01-28 18:32:38 +00:00
|
|
|
class_name WeaponController extends Node3D
|
|
|
|
@export_category("WeaponController")
|
2025-01-28 09:51:45 +00:00
|
|
|
|
|
|
|
# ---------------------------------------------------------------------
|
|
|
|
# Main weapon params
|
|
|
|
# ---------------------------------------------------------------------
|
|
|
|
@export var damage: int = 0
|
|
|
|
# cooldown interval in seconds
|
|
|
|
@export var cooldown: float = 0
|
|
|
|
# bullet speed in m/s
|
2025-01-30 17:04:21 +00:00
|
|
|
@export var bullet_speed: int = 10000
|
2025-01-28 18:32:38 +00:00
|
|
|
@export var bullet_spread_script: GDScript
|
|
|
|
|
2025-01-28 09:51:45 +00:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready() -> void:
|
|
|
|
pass # Replace with function body.
|
|
|
|
@onready var bullet_trace_distance: Node3D = $BulletTraceDistance
|
|
|
|
@onready var bullet_trail_end: Node3D = $BulletTrailEnd
|
2025-01-30 17:04:21 +00:00
|
|
|
@onready var gun_animation = $ShotAnimation
|
|
|
|
|
|
|
|
func shoot():
|
|
|
|
gun_animation.play("cut")
|
2025-01-28 09:51:45 +00:00
|
|
|
|
|
|
|
# -- TODO: It should not be hardcoded
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
pass
|