Working on a modifier property set for merging
This commit is contained in:
parent
47bdf1728c
commit
38696b9398
|
|
@ -44,6 +44,11 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://src/Level.gd"
|
"path": "res://src/Level.gd"
|
||||||
}, {
|
}, {
|
||||||
|
"base": "Reference",
|
||||||
|
"class": "ModifierProperties",
|
||||||
|
"language": "GDScript",
|
||||||
|
"path": "res://src/state_modifier_properties.gd"
|
||||||
|
}, {
|
||||||
"base": "Node",
|
"base": "Node",
|
||||||
"class": "MovementComponent",
|
"class": "MovementComponent",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
|
@ -87,6 +92,7 @@ _global_script_class_icons={
|
||||||
"Interactable": "",
|
"Interactable": "",
|
||||||
"Interactable_Receiver": "",
|
"Interactable_Receiver": "",
|
||||||
"Level": "",
|
"Level": "",
|
||||||
|
"ModifierProperties": "",
|
||||||
"MovementComponent": "",
|
"MovementComponent": "",
|
||||||
"State": "",
|
"State": "",
|
||||||
"StateAnimatedActor": "",
|
"StateAnimatedActor": "",
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,15 @@ enum TYPE {NONE,EXIT_ANIMATION, ANIMATION_SUFFIX, REPLACE_ANIMATION}
|
||||||
|
|
||||||
var debug_state: bool = false
|
var debug_state: bool = false
|
||||||
|
|
||||||
|
## These should be the original properties set when the modifier is created.
|
||||||
|
# property changes can be applied over time but these are the instantiated values.
|
||||||
|
var modifier_properties: ModifierProperties
|
||||||
|
|
||||||
## Animation modifier variables
|
## Animation modifier variables
|
||||||
## The name of the animation that could be applied and starting frame
|
## The name of the animation that could be applied and starting frame
|
||||||
var animation_name: String
|
var animation_name: String
|
||||||
var starting_frame: int = 0
|
var starting_frame: int = 0
|
||||||
|
##TODO: Animation speed
|
||||||
|
|
||||||
## Modification Type
|
## Modification Type
|
||||||
## if an animation is specified, the default behavior will be just to override
|
## if an animation is specified, the default behavior will be just to override
|
||||||
|
|
@ -64,12 +69,20 @@ var state_call_function: FuncRef
|
||||||
#
|
#
|
||||||
# return StateModifier.new()
|
# return StateModifier.new()
|
||||||
#
|
#
|
||||||
#func merge_modifier(merging_mod: StateModifier) -> StateModifier:
|
func merge_modifier(merging_mod: ModifierProperties):
|
||||||
# var new_modifier = StateModifier.new()
|
if merging_mod.modifier_type != TYPE.NONE:
|
||||||
# new_modifier.ready(animation_name, modifier_type, timeout_seconds)
|
print("Warning Merging modifier types that aren't set to 'none' is not supported!")
|
||||||
#
|
return
|
||||||
# return StateModifier.new()
|
# Can't support timeouts or animation stuff right now.
|
||||||
|
#timeout_seconds = merging_mod.timeout_seconds
|
||||||
|
move_speed = merging_mod.move_speed
|
||||||
|
gravity = merging_mod.gravity
|
||||||
|
move_speed_modifier = merging_mod.move_speed_modifier
|
||||||
|
move_speed_modifier_decay = merging_mod.move_speed_modifier_decay
|
||||||
|
|
||||||
|
|
||||||
|
func get_modifier_properties() -> ModifierProperties:
|
||||||
|
return ModifierProperties.new( move_speed, gravity, move_speed_modifier, move_speed_modifier_decay)
|
||||||
|
|
||||||
func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
|
func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeout : float = 0, parent:Node = null, function_name : String = "") -> Timer:
|
||||||
# If somebody forgot to specify the type
|
# If somebody forgot to specify the type
|
||||||
|
|
@ -79,6 +92,9 @@ func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeou
|
||||||
modifier_type = type
|
modifier_type = type
|
||||||
# if parent != null and function_name != "":
|
# if parent != null and function_name != "":
|
||||||
# state_call_function = funcref(parent, function_name)
|
# state_call_function = funcref(parent, function_name)
|
||||||
|
|
||||||
|
modifier_properties = ModifierProperties.new(0,0,0,0)
|
||||||
|
|
||||||
if timeout > 0:
|
if timeout > 0:
|
||||||
state_timeout = Timer.new()
|
state_timeout = Timer.new()
|
||||||
state_timeout.wait_time = timeout
|
state_timeout.wait_time = timeout
|
||||||
|
|
@ -86,6 +102,7 @@ func ready(modifier_name:String, anim_name:String = '', type = TYPE.NONE, timeou
|
||||||
state_timeout.autostart = false
|
state_timeout.autostart = false
|
||||||
return state_timeout
|
return state_timeout
|
||||||
#add_child(state_timeout)
|
#add_child(state_timeout)
|
||||||
|
#ModifierProperties.new()
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
16
src/state_modifier_properties.gd
Normal file
16
src/state_modifier_properties.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
class_name ModifierProperties
|
||||||
|
extends Reference
|
||||||
|
|
||||||
|
var modifier_type: int = 0
|
||||||
|
#var timeout_seconds: float = 0.0
|
||||||
|
var move_speed: float = 0.0
|
||||||
|
var gravity:int = 0
|
||||||
|
var move_speed_modifier: float = 0.0
|
||||||
|
var move_speed_modifier_decay: float = 0.0
|
||||||
|
|
||||||
|
func _init( p_move_speed:float, p_gravity:int , p_move_speed_modifier:float, p_move_speed_modifier_decay:float):
|
||||||
|
#timeout_seconds = p_timeout_seconds
|
||||||
|
move_speed = p_move_speed
|
||||||
|
gravity = p_gravity
|
||||||
|
move_speed_modifier = p_move_speed_modifier
|
||||||
|
move_speed_modifier_decay = p_move_speed_modifier_decay
|
||||||
Loading…
Reference in New Issue
Block a user