2025-09-28 01:32:54 +08:00
|
|
|
local LevelRabbitRole = {}
|
|
|
|
|
|
|
|
|
|
function LevelRabbitRole:ctor()
|
|
|
|
|
self.last_animation = "back/move"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function LevelRabbitRole:ReceiveBeginPlay()
|
2025-10-08 02:52:32 +08:00
|
|
|
-- self["SpineAnimationComponent"]:SetSkin("back/move");
|
|
|
|
|
-- self["SpineAnimationComponent"]:SetAnimation(0, "animation", true);
|
2025-09-28 01:32:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function LevelRabbitRole:OnMove(location)
|
|
|
|
|
-- 控制器移动相应函数
|
|
|
|
|
self["MovementComponent"]:MoveTo(location)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function LevelRabbitRole:UpdateMoveDirection(InDirection)
|
|
|
|
|
-- 运动组件更新方向响应函数
|
|
|
|
|
local cur_animation
|
|
|
|
|
if(InDirection.Y >= 0) then
|
|
|
|
|
cur_animation = "front/move"
|
|
|
|
|
else
|
|
|
|
|
cur_animation = "back/move"
|
|
|
|
|
end
|
|
|
|
|
if cur_animation ~= self.last_animation then
|
|
|
|
|
self["SpineAnimationComponent"]:SetSkin(cur_animation)
|
|
|
|
|
self["SpineAnimationComponent"]:SetSlotsToSetupPose()
|
|
|
|
|
self.last_animation = cur_animation
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-10-08 02:52:32 +08:00
|
|
|
-- function LevelRabbitRole:OnDetachCamera()
|
|
|
|
|
-- print(self, "LevelRabbitRole.OnDetachCamera")
|
2025-09-28 01:32:54 +08:00
|
|
|
|
2025-10-08 02:52:32 +08:00
|
|
|
-- -- 禁用弹簧臂的附着
|
|
|
|
|
-- self["SpringArmComponent"].bEnableCameraRotationLag = true
|
|
|
|
|
-- self["SpringArmComponent"].CameraRotationLagSpeed = 0
|
|
|
|
|
-- -- 保持当前位置,停止跟随
|
|
|
|
|
-- self["SpringArmComponent"].bInheritPitch = true
|
|
|
|
|
-- self["SpringArmComponent"].bInheritYaw = true
|
|
|
|
|
-- self["SpringArmComponent"].bInheritRoll = true
|
2025-09-28 01:32:54 +08:00
|
|
|
|
2025-10-08 02:52:32 +08:00
|
|
|
-- -- (Pitch=0.000000,Yaw=-90.000000,Roll=0.000000)
|
|
|
|
|
-- end
|
2025-09-28 01:32:54 +08:00
|
|
|
|
2025-10-08 02:52:32 +08:00
|
|
|
-- function LevelRabbitRole:OnReattachCamera()
|
|
|
|
|
-- print(self, "LevelRabbitRole.OnReattachCamera")
|
|
|
|
|
-- end
|
2025-09-28 01:32:54 +08:00
|
|
|
|
|
|
|
|
|
2025-10-08 02:52:32 +08:00
|
|
|
-- function LevelRabbitRole:OnMoveCamera(direction)
|
|
|
|
|
-- print(self, "LevelRabbitRole.OnMoveCamera", direction.X, direction.Y)
|
|
|
|
|
-- end
|
2025-09-28 01:32:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
return Class(nil, nil, LevelRabbitRole)
|