Allow using character speed for MoveCharacterCommand
This commit is contained in:
parent
4cb9e96ed8
commit
3d558ca28d
|
@ -15,6 +15,7 @@ time = 1.0
|
|||
script = ExtResource("3_rxd5p")
|
||||
target_character = NodePath("../HiroAI")
|
||||
target_type = "Node"
|
||||
use_character_speed = false
|
||||
speed = 75.0
|
||||
animation_state = "cut_walk"
|
||||
target_vector = Vector2(0, 0)
|
||||
|
|
|
@ -46,7 +46,8 @@ func _on_cutscene_issued_command(command: CutsceneCommand, manager: CutsceneMana
|
|||
movement_scripted_target = command.target_vector if command.target_type == "Vector" else manager.get_node(command.target_node).global_position
|
||||
var approach_direction = global_position.direction_to(movement_scripted_target)
|
||||
set_animation_direction(approach_direction)
|
||||
velocity = command.speed * approach_direction
|
||||
var move_speed = speed if command.use_character_speed else command.speed
|
||||
velocity = move_speed * approach_direction
|
||||
movement_scripted_by = manager
|
||||
movement_scripted_speed = command.speed
|
||||
anim_playback.travel(command.animation_state)
|
||||
|
|
|
@ -8,6 +8,10 @@ class_name MoveCharacterCommand
|
|||
set(value):
|
||||
target_type = value
|
||||
notify_property_list_changed()
|
||||
@export var use_character_speed = true:
|
||||
set(value):
|
||||
use_character_speed = value
|
||||
notify_property_list_changed()
|
||||
@export var speed: float = 300
|
||||
## AnimationTreeFiniteStateMachine state node that will be transitioned to.
|
||||
@export var animation_state: String = ""
|
||||
|
@ -25,3 +29,8 @@ func _validate_property(property: Dictionary):
|
|||
property.usage &= ~PROPERTY_USAGE_READ_ONLY
|
||||
elif property.name == "target_vector" and target_type == "Node":
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY
|
||||
|
||||
if property.name == "speed" and use_character_speed:
|
||||
property.usage |= PROPERTY_USAGE_READ_ONLY
|
||||
elif property.name == "speed" and not use_character_speed:
|
||||
property.usage &= ~PROPERTY_USAGE_READ_ONLY
|
||||
|
|
Loading…
Reference in a new issue