bazar_alea/client/player/character.gd

77 lines
2.2 KiB
GDScript

extends CharacterBody3D
@export var speed = 5.0
@export var jump_velocity = 4.5
var camrot_h:float = 0.0
var camrot_v:float = 0.0
@export var h_acceleration:float = 10.0
@export var v_acceleration:float = 10.0
@export var h_sensitivity:float = 0.5
@export var v_sensitivity:float = 0.5
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
@export var otherplayer:bool = true:
get:
return otherplayer
set(value):
otherplayer = value
func set_otherplayer(value:bool):
otherplayer = value
func _ready():
$SpringArm3D/Camera3D.set_current(false)
#$PlayerGameplayComponent.update_animations()
func set_current_camera() -> void:
$SpringArm3D/Camera3D.set_current(true)
func set_id(value:int) -> void:
$PlayerNetworkingComponent.set_id(value)
func set_activate() -> void:
#$AnimationTree.set_active(true)
#$AnimationTree.set("parameters/Transition/transition_request","Idle")
pass
#func set_animation_tree_blend_positions(input_vector: Vector2) -> void:
# #print("Blend Position: ", input_vector)
# $AnimationTree.set("parameters/Idle/blend_position", input_vector)
# $AnimationTree.set("parameters/Walk/blend_position", input_vector)
func get_animation() -> String:
return $AnimationTree.get("parameters/Transition/current_state") + \
", " + str($AnimationTree.get("parameters/InAir/blend_amount")) + \
", active:" + str($AnimationTree.is_active()) + \
", " + str($AnimationPlayer.get_current_animation()) + \
", " + str($AnimationPlayer.get_current_animation_position()) + \
", " + str($AnimationPlayer.get_autoplay()) + \
", playing:" + str($AnimationPlayer.is_playing()) + \
", " + str($AnimationTree.get("parameters/Transition/current_state")) + \
", " + str($AnimationTree.get("parameters/Transition/current_index"))
func get_gait() -> String:
return Global.GAIT.keys()[$CharacterMovementComponent.gait]
func get_stance() -> String:
return Global.STANCE.keys()[$CharacterMovementComponent.stance]
func get_rotation_mode() -> String:
return Global.ROTATION_MODE.keys()[$CharacterMovementComponent.rotation_mode]
func get_movement_state() -> String:
return Global.MOVEMENT_STATE.keys()[$CharacterMovementComponent.movement_state]