63 lines
1.9 KiB
GDScript
63 lines
1.9 KiB
GDScript
class_name StateModifierAnimatedActor
|
|
extends StateModifier
|
|
|
|
|
|
## Animation modifier variables
|
|
## The name of the animation that could be applied and starting frame
|
|
var animation_name: String = ''
|
|
var animation_suffix: String = ''
|
|
var animation_starting_frame: int = 0
|
|
var animation_speed: float
|
|
|
|
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 reset():
|
|
.reset()
|
|
animation_name = ''
|
|
animation_suffix = ''
|
|
animation_starting_frame = 0
|
|
|
|
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_StateModifierAnimatedActor(_copy_state: StateModifierAnimatedActor):
|
|
.copy(_copy_state)
|
|
_copy_state.animation_name = animation_name
|
|
_copy_state.animation_starting_frame = animation_starting_frame
|
|
_copy_state.animation_speed = animation_speed
|
|
|
|
#TODO: finish these
|
|
_copy_state.horizontal_speed = horizontal_speed
|
|
_copy_state.horizontal_acceleration = horizontal_acceleration
|
|
|
|
func merge_StateModifierAnimatedActor(_copy_state: StateModifierAnimatedActor):
|
|
.merge(_copy_state)
|
|
_copy_state.animation_name += animation_name
|
|
|
|
#_copy_state.animation_starting_frame = animation_starting_frame
|
|
#_copy_state.animation_speed = animation_speed
|
|
|
|
|
|
# This is probably not necessary just access properties directly
|
|
#func animation_mod_setup( anim_name:String = ''):
|
|
# # If somebody forgot to specify the type
|
|
# if anim_name != '' and modifier_type == TYPE.NONE:
|
|
# modifier_type = TYPE.REPLACE_ANIMATION
|
|
# animation_name = anim_name
|
|
## if parent != null and function_name != "":
|
|
## state_call_function = funcref(parent, function_name)
|
|
|