Fix turn combat facing and player movement
This commit is contained in:
@@ -468,6 +468,7 @@ self.NewGameHandler = buttonEntity:ConnectEvent(ButtonClickEvent, self.StartNewG
|
||||
self:SetEntityEnabled("/ui/DefaultGroup/CardHand", true)
|
||||
self:SetEntityEnabled("/ui/DefaultGroup/DeckHud", true)
|
||||
self:ConfigureTurnBasedMonsters()
|
||||
self:ConfigureTurnBasedPlayer()
|
||||
self:StartCombat()`),
|
||||
method('StartCombat', `self.MaxEnergy = 3
|
||||
self.Turn = 0
|
||||
@@ -505,7 +506,7 @@ if monster.RigidbodyComponent ~= nil then
|
||||
end
|
||||
if monster.TransformComponent ~= nil then
|
||||
\tlocal scale = monster.TransformComponent.Scale
|
||||
\tmonster.TransformComponent.Scale = Vector3(-math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
\tmonster.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
end
|
||||
if monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~= nil then
|
||||
\tlocal stand = monster.StateAnimationComponent.ActionSheet["stand"]
|
||||
@@ -513,6 +514,45 @@ if monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~=
|
||||
\t\tmonster.SpriteRendererComponent.SpriteRUID = stand
|
||||
\tend
|
||||
end`, [{ Type: 'Entity', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'monster' }]),
|
||||
method('ConfigureTurnBasedPlayer', `local player = nil
|
||||
pcall(function()
|
||||
\tif _UserService ~= nil and _UserService.LocalPlayer ~= nil then
|
||||
\t\tplayer = _UserService.LocalPlayer
|
||||
\tend
|
||||
end)
|
||||
pcall(function()
|
||||
\tif player == nil and _UserService ~= nil and _UserService.LocalPlayerEntity ~= nil then
|
||||
\t\tplayer = _UserService.LocalPlayerEntity
|
||||
\tend
|
||||
end)
|
||||
pcall(function()
|
||||
\tif player == nil and _UserService ~= nil and _UserService.GetLocalPlayer ~= nil then
|
||||
\t\tplayer = _UserService:GetLocalPlayer()
|
||||
\tend
|
||||
end)
|
||||
if player ~= nil and player.Entity ~= nil then
|
||||
\tplayer = player.Entity
|
||||
end
|
||||
if player == nil then
|
||||
\treturn
|
||||
end
|
||||
if player.PlayerControllerComponent ~= nil then
|
||||
\tplayer.PlayerControllerComponent.Enable = false
|
||||
\tpcall(function() player.PlayerControllerComponent.LookDirectionX = 1 end)
|
||||
end
|
||||
if player.MovementComponent ~= nil then
|
||||
\tplayer.MovementComponent.Enable = false
|
||||
\tpcall(function() player.MovementComponent.InputSpeed = 0 end)
|
||||
\tpcall(function() player.MovementComponent.JumpForce = 0 end)
|
||||
end
|
||||
if player.RigidbodyComponent ~= nil then
|
||||
\tplayer.RigidbodyComponent.MoveVelocity = Vector2.zero
|
||||
\tplayer.RigidbodyComponent.RealMoveVelocity = Vector2.zero
|
||||
end
|
||||
if player.TransformComponent ~= nil then
|
||||
\tlocal scale = player.TransformComponent.Scale
|
||||
\tplayer.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
end`),
|
||||
method('Shuffle', `if list == nil then
|
||||
\treturn
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user