fix weapon draw bug
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
extends Node3D
|
||||
|
||||
const CONFIG_PATH = "weapons.cfg"
|
||||
const REVOLVER = 0
|
||||
const UZI = 1
|
||||
const CHAINSAW = 2
|
||||
signal shoot
|
||||
|
||||
var state = 0
|
||||
@onready var player_root = get_node("../../../../PlayerQ3") as CharacterBody3D
|
||||
@@ -26,8 +24,7 @@ func init():
|
||||
return
|
||||
|
||||
Init_Config(config)
|
||||
weapons[current_weapon].init()
|
||||
raycast.target_position.z = -weapons[current_weapon].RAY_LEN
|
||||
ChangeWeapon(0)
|
||||
|
||||
func Init_Config(config):
|
||||
for weapon in config.get_sections():
|
||||
@@ -96,12 +93,14 @@ func _unhandled_input(_event):
|
||||
func ChangeWeapon(i):
|
||||
weapons[current_weapon].hide()
|
||||
current_weapon = i
|
||||
weapons[current_weapon].show()
|
||||
weapons[current_weapon].init()
|
||||
raycast.target_position.z = -weapons[current_weapon].RAY_LEN
|
||||
|
||||
var time = 0
|
||||
func _process(delta):
|
||||
if Input.is_action_pressed("shoot") && weapons[current_weapon].Shoot():
|
||||
shoot.emit(0.20, 0.15)
|
||||
if(weapons[current_weapon].HITSCAN):
|
||||
HitScan()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user