pickups distributed through level manager. need to fix drop amount
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@export var gun_resource : Resource
|
||||
@export var pickupType: String
|
||||
@export_enum("Ammo", "Stamina", "Health", "Money","Weapon") var pickupType: int
|
||||
@export var collision_shape : Node
|
||||
|
||||
@onready var level_control = get_tree().current_scene
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
@@ -12,3 +14,13 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func picked_up():
|
||||
level_control.held_guns.append(gun_resource)
|
||||
var instance_gun = gun_resource.instantiate()
|
||||
level_control.ammo_current.append(instance_gun.max_ammo)
|
||||
level_control.ammo_reserve.append(instance_gun.max_ammo * instance_gun.start_mags)
|
||||
var weapon_id = level_control.held_guns.size() - 1
|
||||
level_control.player.gun.anim_player.play("swap_out")
|
||||
level_control.gun_spawn(weapon_id)
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user