Added effects manager and two effects to test attached to the player
scene.
This commit is contained in:
parent
1200ac7e32
commit
b4c4a66ce8
19 changed files with 322 additions and 40 deletions
|
|
@ -2,9 +2,12 @@ class_name WeaponComponent extends Node
|
|||
|
||||
@export var weapon_data: WeaponShot = null
|
||||
@export var available_weapons: Array[WeaponShot] = []
|
||||
@export var weapon_change_flash: BaseEffect = null
|
||||
|
||||
var _current_weapon_index: int = 0
|
||||
|
||||
@onready var effects_component: EffectComponent = %EffectsComponent
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
# Set the default weapon to be stock, i.e. index 1
|
||||
|
|
@ -36,10 +39,16 @@ func select_weapon_by_name(name: String) -> bool:
|
|||
print("Switched to: ", name)
|
||||
|
||||
_emit_weapon_changed()
|
||||
_trigger_change_flash()
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _trigger_change_flash() -> void:
|
||||
if weapon_change_flash and effects_component:
|
||||
effects_component.apply_effect(weapon_change_flash)
|
||||
|
||||
|
||||
|
||||
func cycle_weapon() -> void: # Used for testing weapon cycling
|
||||
if available_weapons.is_empty():
|
||||
|
|
@ -50,3 +59,4 @@ func cycle_weapon() -> void: # Used for testing weapon cycling
|
|||
print("Switched to: ", weapon_data.shot_name)
|
||||
|
||||
_emit_weapon_changed()
|
||||
_trigger_change_flash()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue