weapon speed modifiers
This commit is contained in:
parent
ac8ea51d9c
commit
7c7f68b6f5
8 changed files with 37 additions and 21 deletions
|
|
@ -5,9 +5,11 @@ const active_bomb: StringName = "uid://dtbpyfdawb02b"
|
|||
func enter():
|
||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
machine.speed_modifier = 0.0
|
||||
|
||||
func exit():
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
machine.speed_modifier = 1.0
|
||||
|
||||
func on_animation_finished(animation: StringName):
|
||||
if animation == machine.animation_prefix + "plant":
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ class_name WeaponSubStateMachine
|
|||
@onready var ammo: int = max_ammo
|
||||
@onready var remaining_ammo: int = max_ammo * 3
|
||||
|
||||
@export var speed_modifier: float = 1.0
|
||||
|
||||
@export var can_be_previous: bool = true
|
||||
@export var destroy_when_empty: bool = false
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ signal switched_to(state: WeaponSubStateMachine)
|
|||
func _ready() -> void:
|
||||
$WeaponSpawner.spawn_function = pick_up_weapon
|
||||
|
||||
func get_speed_modifier() -> float:
|
||||
if current_state == null:
|
||||
return 1
|
||||
return current_state.speed_modifier
|
||||
|
||||
func can_add(slot: StringName) -> bool:
|
||||
return slots.has(slot) and slots[slot] == null
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue