30 lines
936 B
GDScript
30 lines
936 B
GDScript
class_name WeaponController extends Node3D
|
|
@export_category("WeaponController")
|
|
|
|
# ---------------------------------------------------------------------
|
|
# Main weapon params
|
|
# ---------------------------------------------------------------------
|
|
@export var damage: int = 0
|
|
# cooldown interval in seconds
|
|
@export var cooldown: float = 0
|
|
# bullet speed in m/s
|
|
@export var bullet_speed: int = 10000
|
|
@export var bullet_spread_script: GDScript
|
|
|
|
|
|
# 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
|
|
@onready var gun_animation = $ShotAnimation
|
|
|
|
func shoot():
|
|
gun_animation.play("cut")
|
|
|
|
# -- TODO: It should not be hardcoded
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|