42 lines
1.3 KiB
GDScript
42 lines
1.3 KiB
GDScript
class_name StateModifierMovement
|
|
extends StateModifier
|
|
|
|
## Movement Modifiers
|
|
var horizontal_speed: float = 0
|
|
var horizontal_acceleration: float = 0
|
|
## Movement Speed Offsets (Positive or Negative)
|
|
var horizontal_speed_offset: float = 0
|
|
## Applies only if offset applies
|
|
var horizontal_speed_offset_acceleration: float = 0
|
|
var jerk_factor: float = 0
|
|
|
|
var gravity: int = 0
|
|
|
|
func _to_string():
|
|
return "StateModifierMovement"
|
|
|
|
func reset():
|
|
.reset()
|
|
|
|
horizontal_speed = 0
|
|
horizontal_acceleration = 0
|
|
## Movement Speed Offsets (Positive or Negative)
|
|
horizontal_speed_offset = 0
|
|
## Applies only if offset applies
|
|
horizontal_speed_offset_acceleration = 0
|
|
jerk_factor = 0
|
|
|
|
func copy(_copy_state: StateModifier):
|
|
.copy(_copy_state)
|
|
if _copy_state.to_string() == "StateModifierMovement":
|
|
_copy_state.horizontal_speed = horizontal_speed
|
|
_copy_state.horizontal_acceleration = horizontal_acceleration
|
|
|
|
func merge(_merge_from_modifier: StateModifier):
|
|
.merge(_merge_from_modifier)
|
|
if _merge_from_modifier.to_string() == "StateModifierMovement":
|
|
horizontal_speed += _merge_from_modifier.horizontal_speed
|
|
horizontal_acceleration += _merge_from_modifier.horizontal_acceleration
|
|
horizontal_speed_offset += _merge_from_modifier.horizontal_speed_offset
|
|
horizontal_speed_offset_acceleration += _merge_from_modifier.horizontal_speed_offset_acceleration
|