후자겠지?
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 26391 | 02-02 | 140 | ||
| 26390 | 02-02 | 1397 | ||
| 26389 | 02-02 | 463 | ||
| 26388 | 메소 ㅍㅍ+1 | 02-02 | 131 | |
| 26387 | 02-02 | 402 | ||
| 26386 | 02-02 | 140 | ||
| 26385 | 02-02 | 230 | ||
| 26384 | 02-02 | 444 | ||
| 26383 | 02-02 | 126 | ||
| 26382 | 02-02 | 183 | ||
| 26381 | 02-02 | 436 | ||
| 26380 | 썬콜 40렙+5 | 02-02 | 195 | |
| 26379 | 02-02 | 198 | ||
| 26378 | 다클라사용해라+4 | 02-02 | 525 | |
| 26377 | 02-02 | 189 | ||
| 26376 | 02-02 | 437 | ||
| 26375 | 02-02 | 222 | ||
| 26374 | 02-02 | 798 | ||
| 26373 | 02-02 | 197 | ||
| 26372 | 02-02 | 247 |
댓글2
foothold
return function (self)
local m = self.CachedMoveAbility
local mob = self.Entity
local fh = mob.RigidbodyComponent:GetCurrentFoothold()
if (not fh) then
-- log("no foothold ", mob.Name)
return
end
if (self.LocalInputX == 0) then
-- log("self.LocalInputX is 0")
return
end
local now = _UtilLogic.ServerElapsedSeconds
if (now < self.NextUpdateWait) then
-- log("waiting next update ", self.NextUpdateWait)
return
end
if (m == _MoveAbility.Jump or m == _MoveAbility.Walk) then
local state = mob.StateComponent.CurrentStateName
if (state ~= _MobAction.Stand and state ~= _MobAction.Move and state ~= _MobAction.Jump) then
return
end
local forwardDir = mob.SpriteRendererComponent.FlipX and 1 or -1
local mobPos = mob.TransformComponent.WorldPosition
local x = mobPos.x
local map = mob.CurrentMap
local platform = map.PlatformInfoComponent.FootholdToPlatform[fh.Id]
if (not platform) then
log_error("failed to get platform: ", fh.Id)
return
end
local dir = 0
local wallHeight = 0
local edgeGap = nil
local edge = nil
local bv = map.MapInfoComponent.IsBlockedVertical
if (forwardDir < 0) then
edge = platform.left.x
edgeGap = x - edge
dir = platform.left.dir
wallHeight = platform.left.length
--log(string.format("forward:%d / edge:%.2f / edgeGap:%.2f / dir:%d / isolatedMove:%s",
-- forwardDir, edge, edgeGap, dir, tostring(mob.RigidbodyComponent.IsolatedMove)))
else
edge = platform.right.x
edgeGap = edge - x
dir = platform.right.dir
wallHeight = platform.right.length
--log(string.format("forward:%d / edge:%.2f / edgeGap:%.2f / dir:%d / isolatedMove:%s",
-- forwardDir, edge, edgeGap, dir, tostring(mob.RigidbodyComponent.IsolatedMove)))
end
local function playJump(jumpDir)
-- 클라이언트에게 갱신되기 전에 또 업데이트 되는 것 방지
self.NextUpdateWait = now + 1
map.LifeControllerComponent:RequestControl(mob, {
{ _MobActionPartType.Jump, jumpDir, 0 }
}, 1, false)
--log("playJump")
end
local function getHomePlatform()
local id = mob.MobComponent.HomePlatformId
if (id > 0) then
return map.PlatformInfoComponent.Platforms[id]
end
return nil
end
local function isBelongToHomePlatform()
local home = getHomePlatform()
if (home) then
if (forwardDir < 0) then
if (home.left.x + 0.6 < edge) then
return true
end
else
if (home.right.x - 0.6 > edge) then
return true
end
end
else
-- log_error(string.format("no home platform '%s' (%s)", self.Entity.Id, self.Entity.Path))
end
return false
end
local function tryWallJump()
-- 풋홀드 끝 점프
if (dir == 0) then
--log("trying object edge jump")
if (isBelongToHomePlatform()) then
playJump(1)
return true
end
if (bv) then
if (_GlobalRand32:RandomDouble() < 0.2) then
playJump(1)
return true
end
end
elseif (dir > 0) then
--log("trying wall jump")
if (bv) then
return false
end
if (wallHeight > 0.65) then
return false
end
playJump(1)
return true
elseif (dir < 0) then
if (isBelongToHomePlatform()) then
playJump(-1)
return true
end
-- fallback
---@type Foothold
local forward = _FootholdLogic:GetForwardLink(mob.CurrentMap, fh, forwardDir, x, 1.5)
if (forward and forward.Variance.x ~= 0) then
--log("trying wall down")
playJump(-1)
return true
end
end
return false
end
local function turnAround()
-- 방향 전환이 다시 클라이언트에게 갱신되기 전에 또 업데이트 되는 것 방지
self.NextUpdateWait = now + 2
self.NextRandomJump = now + _GlobalRand32:RandomIntegerRange(1000, 1500) / 1000
mob.CurrentMap.LifeControllerComponent:RequestControl(mob, {
{ _MobActionPartType.Move, -forwardDir, 0, nil }
}, 1, false)
end
local function tryRandomJump(rate)
-- 랜덤 점프
if (now >= self.NextRandomJump) then
if (_GlobalRand32:RandomDouble() < rate) then
playJump(1)
else
--log("no random jump")
end
self.NextRandomJump = now + _GlobalRand32:RandomIntegerRange(1000, 3000) / 1000
end
end
---@param target Entity
local function tryChaseJump(target)
local wPos = target.TransformComponent.WorldPosition
local xGap = math.abs(wPos.x - x)
if (xGap < 1.5) then
local yGap = wPos.y - mobPos.y
if (yGap > 0.1 and yGap < 3) then
if (target.RigidbodyComponent:GetCurrentFoothold()) then
tryRandomJump(0.75)
elseif (yGap > 0.6 and _CharacterActionLogic:IsOnLadderOrRope(target.StateComponent.CurrentStateName)) then
tryRandomJump(0.5)
end
end
end
end
if (edgeGap ~= nil) then
if (edgeGap <= 0.65) then
if (m == _MoveAbility.Jump) then
if (tryWallJump()) then
return
end
local target = self.Target
if (isvalid(target)) then
tryChaseJump(target)
end
end
turnAround()
elseif (edgeGap >= 2) then
if (m == _MoveAbility.Jump) then
local target = self.Target
if (isvalid(target)) then
tryChaseJump(target)
else
tryRandomJump(0.2)
end
end
end
end
end
end