This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-06-18 01:43:10 +02:00
|
|
|
extends Node3D
|
|
|
|
|
2021-07-04 21:50:13 +02:00
|
|
|
@onready var ejector = find_node("Ejector")
|
|
|
|
@onready var muzzle = find_node("Muzzle")
|
|
|
|
|
|
|
|
var casing = preload("res://Assets/Weapons/Handgun/Casing.tscn")
|
|
|
|
var flash = preload("res://Assets/Weapons/Handgun/Flash.tscn")
|
|
|
|
|
2021-06-18 01:43:10 +02:00
|
|
|
# Declare member variables here. Examples:
|
|
|
|
# var a = 2
|
|
|
|
# var b = "text"
|
|
|
|
|
|
|
|
#enum Trigger {TRIGGER_PRIMARY, TRIGGER_SECONDARY}
|
|
|
|
|
2021-07-04 21:50:13 +02:00
|
|
|
@puppetsync func trigger(index: int, active: bool) -> void:
|
2021-06-18 01:43:10 +02:00
|
|
|
print("Weapon " + str(name) + ", Trigger " + str(index) + ", active: " + str(active))
|
|
|
|
|
|
|
|
if index == 0 and active:
|
2021-07-04 21:50:13 +02:00
|
|
|
|
|
|
|
$Handgun/AnimationPlayer.play("Shoot", 0, 2.5)
|
|
|
|
|
|
|
|
var flash_effect = flash.instance()
|
|
|
|
get_parent().add_child(flash_effect)
|
|
|
|
flash_effect.global_transform = muzzle.global_transform
|
2021-06-18 01:43:10 +02:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
2021-07-04 21:50:13 +02:00
|
|
|
pass
|