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 func _to_string(): return "StateModifierAnimatedActor" func reset(): .reset() animation_name = '' animation_suffix = '' animation_starting_frame = 0 func copy(_copy_state: StateModifier): .copy(_copy_state) ## Using is gives me cyclic redundancy problems #if _copy_state is StateModifierAnimatedActor: #if _copy_state.is_class("StateModifierAnimatedActor"): if _copy_state.to_string() == "StateModifierAnimatedActor": _copy_state.animation_name = animation_name _copy_state.animation_starting_frame = animation_starting_frame _copy_state.animation_speed = animation_speed else: print_debug("Non AnimatedActor modifier passed into this modifier") ##DEPR: Need to remove this #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 func merge(_merge_from_modifier: StateModifier): .merge(_merge_from_modifier) #print(_merge_from_modifier.to_string(), " I'm a mod named: ", _merge_from_modifier.get_class()) #if _merge_from_modifier is StateModifierAnimatedActor: if _merge_from_modifier.to_string() == "StateModifierAnimatedActor": if modifier_type == TYPE.NONE and _merge_from_modifier.modifier_type != TYPE.NONE: modifier_type = _merge_from_modifier.modifier_type #_copy_state.animation_name += animation_name match _merge_from_modifier.modifier_type: TYPE.ANIMATION_SUFFIX: # Attempt to seemlessly transition animations. if _merge_from_modifier.animation_suffix != '': animation_suffix = _merge_from_modifier.animation_suffix TYPE.REPLACE_ANIMATION: if _merge_from_modifier.animation_name != '': animation_name = _merge_from_modifier.animation_name # _: # None # print ('physics?') ##DEPR: Need to remove this #func merge_StateModifierAnimatedActor(_merge_from_modifier: StateModifierAnimatedActor): # .merge(_merge_from_modifier) # if modifier_type == TYPE.NONE and _merge_from_modifier.modifier_type != TYPE.NONE: # modifier_type = _merge_from_modifier.modifier_type # # #_copy_state.animation_name += animation_name # match _merge_from_modifier.modifier_type: # TYPE.ANIMATION_SUFFIX: # # Attempt to seemlessly transition animations. # if _merge_from_modifier.animation_suffix != '': # animation_suffix = _merge_from_modifier.animation_suffix # TYPE.REPLACE_ANIMATION: # if _merge_from_modifier.animation_name != '': # animation_name = _merge_from_modifier.animation_name # _: # None # print ('physics?') # # #_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)