狐狸接入
This commit is contained in:
BIN
Content/Blueprint/Level/Actor/Role/BP_Fox.uasset
Normal file
BIN
Content/Blueprint/Level/Actor/Role/BP_Fox.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Data/Input/Level/IA_SwitchRole.uasset
Normal file
BIN
Content/Data/Input/Level/IA_SwitchRole.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,47 @@
|
||||
local LevelFoxRole = {}
|
||||
local Vector2D = require("Utils.Vector2D")
|
||||
|
||||
function LevelFoxRole:ctor()
|
||||
|
||||
end
|
||||
|
||||
function LevelFoxRole:ReceiveBeginPlay()
|
||||
self["SpineAnimationComponent"]:SetAnimation(0, "Idle/Front", true)
|
||||
self.last_animation = "Idle/Front"
|
||||
end
|
||||
|
||||
|
||||
function LevelFoxRole:OnMoveDirectionChanged(InDirection)
|
||||
-- 运动组件更新方向响应函数
|
||||
local cur_animation
|
||||
|
||||
if Vector2D.Equals(InDirection, Vector2D.Zero) then -- Idle的情况
|
||||
local forward_direction = self["MovementComponent"]:GetForwardDirection()
|
||||
if(forward_direction.Y >= 0) then
|
||||
cur_animation = "Idle/Front"
|
||||
else
|
||||
cur_animation = "Idle/Back"
|
||||
end
|
||||
else
|
||||
if(InDirection.Y >= 0) then
|
||||
cur_animation = "Move/Front"
|
||||
else
|
||||
cur_animation = "Move/Back"
|
||||
end
|
||||
end
|
||||
-- if cur_animation ~= self.last_animation then
|
||||
print("changed", cur_animation)
|
||||
|
||||
self["SpineAnimationComponent"]:SetAnimation(0, cur_animation, true)
|
||||
self.last_animation = cur_animation
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
function LevelFoxRole:OnMove(location)
|
||||
-- 控制器移动相应函数
|
||||
self["MovementComponent"]:MoveTo(location)
|
||||
end
|
||||
|
||||
|
||||
return Class(nil, nil, LevelFoxRole)
|
||||
@ -5,8 +5,8 @@ function LevelRabbitRole:ctor()
|
||||
end
|
||||
|
||||
function LevelRabbitRole:ReceiveBeginPlay()
|
||||
self["SpineAnimationComponent"]:SetSkin("back/move");
|
||||
self["SpineAnimationComponent"]:SetAnimation(0, "animation", true);
|
||||
-- self["SpineAnimationComponent"]:SetSkin("back/move");
|
||||
-- self["SpineAnimationComponent"]:SetAnimation(0, "animation", true);
|
||||
end
|
||||
|
||||
|
||||
@ -31,28 +31,28 @@ function LevelRabbitRole:UpdateMoveDirection(InDirection)
|
||||
end
|
||||
end
|
||||
|
||||
function LevelRabbitRole:OnDetachCamera()
|
||||
print(self, "LevelRabbitRole.OnDetachCamera")
|
||||
-- function LevelRabbitRole:OnDetachCamera()
|
||||
-- print(self, "LevelRabbitRole.OnDetachCamera")
|
||||
|
||||
-- 禁用弹簧臂的附着
|
||||
self["SpringArmComponent"].bEnableCameraRotationLag = true
|
||||
self["SpringArmComponent"].CameraRotationLagSpeed = 0
|
||||
-- 保持当前位置,停止跟随
|
||||
self["SpringArmComponent"].bInheritPitch = true
|
||||
self["SpringArmComponent"].bInheritYaw = true
|
||||
self["SpringArmComponent"].bInheritRoll = true
|
||||
-- -- 禁用弹簧臂的附着
|
||||
-- self["SpringArmComponent"].bEnableCameraRotationLag = true
|
||||
-- self["SpringArmComponent"].CameraRotationLagSpeed = 0
|
||||
-- -- 保持当前位置,停止跟随
|
||||
-- self["SpringArmComponent"].bInheritPitch = true
|
||||
-- self["SpringArmComponent"].bInheritYaw = true
|
||||
-- self["SpringArmComponent"].bInheritRoll = true
|
||||
|
||||
-- (Pitch=0.000000,Yaw=-90.000000,Roll=0.000000)
|
||||
end
|
||||
-- -- (Pitch=0.000000,Yaw=-90.000000,Roll=0.000000)
|
||||
-- end
|
||||
|
||||
function LevelRabbitRole:OnReattachCamera()
|
||||
print(self, "LevelRabbitRole.OnReattachCamera")
|
||||
end
|
||||
-- function LevelRabbitRole:OnReattachCamera()
|
||||
-- print(self, "LevelRabbitRole.OnReattachCamera")
|
||||
-- end
|
||||
|
||||
|
||||
function LevelRabbitRole:OnMoveCamera(direction)
|
||||
print(self, "LevelRabbitRole.OnMoveCamera", direction.X, direction.Y)
|
||||
end
|
||||
-- function LevelRabbitRole:OnMoveCamera(direction)
|
||||
-- print(self, "LevelRabbitRole.OnMoveCamera", direction.X, direction.Y)
|
||||
-- end
|
||||
|
||||
|
||||
return Class(nil, nil, LevelRabbitRole)
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
local Vector2D = {}
|
||||
local Vector2D = {
|
||||
Zero = {X = 0, Y = 0}
|
||||
}
|
||||
function Vector2D.New(x, y)
|
||||
return {X = x or 0, Y = y or 0}
|
||||
end
|
||||
@ -46,5 +48,10 @@ function Vector2D.ToUnrealEngine3D(vector, z)
|
||||
return new_vector
|
||||
end
|
||||
|
||||
function Vector2D.Equals(a, b, tolerance)
|
||||
local tol = tolerance or 0.001
|
||||
print(tol, a.X-b.X, a.Y-b.Y)
|
||||
return math.abs(a.X - b.X) < tol and math.abs(a.Y - b.Y) < tol
|
||||
end
|
||||
|
||||
return Vector2D
|
||||
BIN
Content/Resource/Spine/Role/Fox/Fox.uasset
Normal file
BIN
Content/Resource/Spine/Role/Fox/Fox.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Spine/Role/Fox/FoxData.uasset
Normal file
BIN
Content/Resource/Spine/Role/Fox/FoxData.uasset
Normal file
Binary file not shown.
BIN
Content/Resource/Spine/Role/Fox/Textures/Fox.uasset
Normal file
BIN
Content/Resource/Spine/Role/Fox/Textures/Fox.uasset
Normal file
Binary file not shown.
Reference in New Issue
Block a user