Started implementing proper weapon control API

remotes/1699310152913738325/tmp_refs/heads/legacy
unfa 2021-05-02 23:27:25 +02:00
parent 94e527bc75
commit a632ac9892
3 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,26 @@
extends "res://Classes/Weapon/Weapon.gd"
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
#var trigger_held_primary = false
#var trigger_held_secondary = false
#var is_reloading = false
func set_trigger_held_primary(active:bool):
trigger_held_primary = active
print("trigger_active", active)
#func get_trigger_held_primary():
# return trigger_held_primary
# print("trigger_get")
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -380,7 +380,8 @@ func shoot(trigger_held):
# The underscore indicates an unused variable.
# Because it is declared in this scope, it will disappear as soon as the
# function returns. As is, it exists solely to catch the return value of shoot().
var _remaining_ammo = active_weapon.shoot($Camera, true, trigger_held)
#var _remaining_ammo = active_weapon.shoot($Camera, true, trigger_held)
active_weapon.trigger_held_primary = trigger_held
func reload():
active_weapon.reload()

View File

@ -25,6 +25,17 @@ var cached_fire = false
var casing = preload("res://Assets/Weapons/Handgun/Casing.tscn")
var tracer = preload("res://Assets/Effects/BulletTracer.tscn")
var trigger_held_primary = false setget set_trigger_held_primary, get_trigger_held_primary
var trigger_held_secondary = false
var is_reloading = false
#var is_active = false #TODO - for reimplementing weapins switching
func set_trigger_held_primary(active:bool):
trigger_held_primary = active
func get_trigger_held_primary():
return trigger_held_primary
func _ready():
$Sounds.global_transform.origin = camera.global_transform.origin