push project up sabs assets
This commit is contained in:
56
scenes/individual_parts/cue/cue_base.gd
Normal file
56
scenes/individual_parts/cue/cue_base.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
class_name CueBase extends Node3D
|
||||
|
||||
|
||||
@onready var inclination: Node3D = $inclination
|
||||
@onready var pool_cue_tip: PoolCueTip = $inclination/pool_cue_tip
|
||||
@onready var animation_player: AnimationPlayer = $animation_player
|
||||
@onready var cue_cam_marker: Marker3D = $cue_cam_marker
|
||||
|
||||
var cue_shape: CollisionShape3D
|
||||
var cue_rotation: float = 0.0
|
||||
var cue_inclination: float = 0.0
|
||||
|
||||
|
||||
func reset_state() -> void:
|
||||
cue_shape.set_deferred("disabled", true)
|
||||
animation_player.play("RESET")
|
||||
|
||||
func rewind_anim(delta: float, target_seek: float, animation: String) -> float:
|
||||
animation_player.set_current_animation(animation)
|
||||
|
||||
target_seek -= delta * 0.2
|
||||
if target_seek < 0.0:
|
||||
target_seek = animation_player.get_current_animation_length()
|
||||
|
||||
animation_player.seek(target_seek, true)
|
||||
animation_player.stop(true)
|
||||
|
||||
return target_seek
|
||||
|
||||
func forward_anim(delta: float, target_seek: float, animation: String) -> float:
|
||||
animation_player.set_current_animation(animation)
|
||||
|
||||
target_seek += delta * 0.2
|
||||
if target_seek > animation_player.get_current_animation_length():
|
||||
target_seek = 0.0
|
||||
|
||||
animation_player.seek(target_seek, true)
|
||||
animation_player.stop(true)
|
||||
|
||||
return target_seek
|
||||
|
||||
func cue_kick() -> void:
|
||||
animation_player.stop()
|
||||
animation_player.set_current_animation("RESET")
|
||||
|
||||
animation_player.set_speed_scale(
|
||||
-1 / animation_player.get_current_animation_position()
|
||||
)
|
||||
animation_player.seek(animation_player.get_current_animation_position(), true)
|
||||
animation_player.play_section_backwards(
|
||||
"aim_release",
|
||||
animation_player.get_current_animation_position(),
|
||||
0.0
|
||||
)
|
||||
|
||||
animation_player.set_speed_scale(-1)
|
||||
Reference in New Issue
Block a user