Recoil system
This commit is contained in:
parent
1c062489b1
commit
cdfce4c7db
11 changed files with 144 additions and 8 deletions
|
|
@ -34,6 +34,7 @@ func fire() -> void:
|
|||
raycast.get_collider().hp -= damage
|
||||
|
||||
fire_timer.start()
|
||||
machine.player_camera.recoil(0,0.1)
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class_name WeaponSubStateMachine
|
|||
|
||||
var system: WeaponSystem
|
||||
var animation_player: AnimationPlayer
|
||||
var player_camera: PlayerCamera
|
||||
|
||||
func _ready() -> void:
|
||||
for child in get_children():
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class_name WeaponSystem
|
|||
@export var default_knife: WeaponSubStateMachine
|
||||
|
||||
@export var animation_player: AnimationPlayer
|
||||
@export var camera: PlayerCamera
|
||||
|
||||
var current_state: WeaponSubStateMachine
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ func _ready() -> void:
|
|||
if child is WeaponSubStateMachine:
|
||||
child.system = self
|
||||
child.animation_player = animation_player
|
||||
child.player_camera = camera
|
||||
else:
|
||||
push_warning("Child of weapon system is not ability or weapon")
|
||||
|
||||
|
|
@ -46,6 +48,8 @@ func add(state: WeaponSubStateMachine, slot: StringName) -> void:
|
|||
|
||||
slots[slot] = state
|
||||
state.system = self
|
||||
state.animation_player = animation_player
|
||||
state.player_camera = camera
|
||||
|
||||
|
||||
func switch(to: StringName):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue