阶段暂存
This commit is contained in:
@ -1,11 +0,0 @@
|
||||
local BusyPlayerRole = {}
|
||||
|
||||
function BusyPlayerRole:UpdateMoveDirection(InDirection)
|
||||
if(InDirection.Y > 0) then
|
||||
self["SpineAnimationComponent"]:SetSkin("front/move")
|
||||
else
|
||||
self["SpineAnimationComponent"]:SetSkin("back/move")
|
||||
end
|
||||
end
|
||||
|
||||
return Class(nil, nil, BusyPlayerRole)
|
||||
4
Content/Lua/Level/Actor/LevelFoxRole.lua
Normal file
4
Content/Lua/Level/Actor/LevelFoxRole.lua
Normal file
@ -0,0 +1,4 @@
|
||||
local LevelFoxRole = {}
|
||||
|
||||
|
||||
return Class(nil, nil, LevelFoxRole)
|
||||
58
Content/Lua/Level/Actor/LevelRabbitRole.lua
Normal file
58
Content/Lua/Level/Actor/LevelRabbitRole.lua
Normal file
@ -0,0 +1,58 @@
|
||||
local LevelRabbitRole = {}
|
||||
|
||||
function LevelRabbitRole:ctor()
|
||||
self.last_animation = "back/move"
|
||||
end
|
||||
|
||||
function LevelRabbitRole:ReceiveBeginPlay()
|
||||
self["SpineAnimationComponent"]:SetSkin("back/move");
|
||||
self["SpineAnimationComponent"]:SetAnimation(0, "animation", true);
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
-- (Pitch=0.000000,Yaw=-90.000000,Roll=0.000000)
|
||||
end
|
||||
|
||||
function LevelRabbitRole:OnReattachCamera()
|
||||
print(self, "LevelRabbitRole.OnReattachCamera")
|
||||
end
|
||||
|
||||
|
||||
function LevelRabbitRole:OnMoveCamera(direction)
|
||||
print(self, "LevelRabbitRole.OnMoveCamera", direction.X, direction.Y)
|
||||
end
|
||||
|
||||
|
||||
return Class(nil, nil, LevelRabbitRole)
|
||||
4
Content/Lua/Level/Actor/Static/Campsite.lua
Normal file
4
Content/Lua/Level/Actor/Static/Campsite.lua
Normal file
@ -0,0 +1,4 @@
|
||||
local Campsite = {}
|
||||
|
||||
|
||||
return Class(nil, nil, Campsite)
|
||||
@ -1,13 +1,36 @@
|
||||
local Vector = import("Vector")
|
||||
local GameplayStatics = import("GameplayStatics")
|
||||
local BusyGameplayLibrary = import("BusyGameplayLibrary")
|
||||
|
||||
--- 保留到以后做联机内容时拓展
|
||||
--- @class LevelGameMode
|
||||
--- @field GameMapActorClass table
|
||||
local LevelGameMode = {}
|
||||
|
||||
function LevelGameMode:K2_PostLogin(new_player_controller)
|
||||
|
||||
local new_player_state = new_player_controller.PlayerState
|
||||
|
||||
local role = new_player_state:CreateRoleRoster(new_player_controller)
|
||||
|
||||
new_player_controller:Possess(role)
|
||||
|
||||
function LevelGameMode:ctor()
|
||||
self.map_actor = nil
|
||||
end
|
||||
|
||||
function LevelGameMode:ReceiveBeginPlay()
|
||||
print("LevelGameMode:ReceiveBeginPlay", self.GameMapActorClass)
|
||||
local world = BusyGameplayLibrary.K2_GetWorld(self)
|
||||
local game_state = GameplayStatics.GetGameState(self) --- @type LevelGameState
|
||||
|
||||
if self.GameMapActorClass then
|
||||
local map_actor = world:SpawnActor(self.GameMapActorClass, Vector(), nil, nil)
|
||||
game_state:SetGameMapActor(map_actor)
|
||||
end
|
||||
end
|
||||
|
||||
-- function LevelGameMode:K2_PostLogin(new_player_controller)
|
||||
-- local new_player_state = new_player_controller.PlayerState
|
||||
-- local role = new_player_state:CreateRoleRoster(new_player_controller)
|
||||
-- local new_pos = FVector()
|
||||
-- new_pos.X = 500
|
||||
-- new_pos.Y = 500
|
||||
-- new_pos.Z = 50
|
||||
-- role:K2_SetActorLocation(new_pos, true, nil, false)
|
||||
-- new_player_controller:Possess(role)
|
||||
-- end
|
||||
|
||||
return Class(nil, nil, LevelGameMode)
|
||||
9
Content/Lua/Level/LevelGameState.lua
Normal file
9
Content/Lua/Level/LevelGameState.lua
Normal file
@ -0,0 +1,9 @@
|
||||
--- @class LevelGameState
|
||||
local LevelGameState = {}
|
||||
|
||||
function LevelGameState:SetGameMapActor(game_map_actor)
|
||||
self.GameMapActor = game_map_actor
|
||||
end
|
||||
|
||||
|
||||
return Class(nil, nil, LevelGameState)
|
||||
12
Content/Lua/Level/LevelPlayerState.lua
Normal file
12
Content/Lua/Level/LevelPlayerState.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local GameplayStatics = import("GameplayStatics")
|
||||
|
||||
local LevelPlayerState = {}
|
||||
|
||||
function LevelPlayerState:ReceiveBeginPlay()
|
||||
local pc = GameplayStatics.GetPlayerController(self, 0)
|
||||
local role = self:CreateRoleRoster(pc)
|
||||
print("LevelPlayerState:ReceiveBeginPlay", role, self:HasAuthority())
|
||||
pc:Possess(role)
|
||||
end
|
||||
|
||||
return Class(nil, nil, LevelPlayerState)
|
||||
Reference in New Issue
Block a user