return function(self, mob, hitByLeft, knockbackType)
local kb = mob.MobKnockbackComponent
local ai = mob.MobAIComponent
local rb = mob.MobRigidbodyComponent
local map = mob.CurrentMap
local boundLt, boundRb = map.MapComponent:GetBound()
local minX = boundLt.x + 0.1
local maxX = boundRb.x - 0.1
local mobPos = mob.TransformComponent.WorldPosition:ToVector2()
local sqrt = math.sqrt
local elapse = 0
local knockbackMoveEnd
local interruptedEnd
if (knockbackType == 2) then
knockbackMoveEnd = 0.5
interruptedEnd = 0.7
else
knockbackMoveEnd = 0.1
interruptedEnd = 0.5
end
local timelines = {}
local timelineIndex = 0
local currentX = mobPos.x
local currentY = mobPos.y
local function makeDistance(x1, y1, x2, y2)
return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
end
kb:SetShoeAttr(knockbackType)
local knockbackSpeed = rb.WalkSpeed * _Physics.FlySpeed / 100
local function makeFlyCommand(cmd, destX, destY, floating)
local distance = makeDistance(currentX, currentY, destX, destY)
currentX = destX
currentY = destY
local duration = distance / knockbackSpeed
timelines[timelineIndex + 1] = {cmd, {destX, destY, duration, floating}, 0}
timelineIndex += 1
return duration
end
local function makeCommand(cmd, value, nextTime)
timelines[timelineIndex + 1] = {cmd, value, nextTime}
timelineIndex += 1
end
local inputX = 1
if (hitByLeft) then
inputX = -1
end
makeCommand(_MobActionPartType.HitMotion, 1, 0)
local knockbackDestX = mobPos.x
local delta = knockbackSpeed * knockbackMoveEnd
if (inputX < 0) then
knockbackDestX = math.max(minX, mobPos.x - delta)
else
knockbackDestX = math.min(maxX, mobPos.x + delta)
end
if (mobPos.x ~= knockbackDestX) then
mobPos.y = mobPos.y + 0.02
makeCommand(_MobActionPartType.KnockbackPos, mobPos, 0)
makeFlyCommand(_MobActionPartType.KnockbackFly, knockbackDestX, mobPos.y, false)
end
makeCommand(_MobActionPartType.HitMotion, 0, interruptedEnd)
if (timelineIndex > 0) then
map.LifeControllerComponent:RequestControl(mob, timelines, timelineIndex, true)
end
ai:EnableNextControlTimer(interruptedEnd)
ai:SetLocalControlUpdate(true, interruptedEnd)end
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 23852 | 점언..+2 | 01-31 | 375 | |
| 23851 | 자 여기까지+7 | 01-31 | 882 | |
| 23850 | 01-31 | 228 | ||
| 23849 | 뿌린다 1ㄷ1 ㄴㄴ+17 | 01-31 | 999 | |
| 23848 | 01-31 | 250 | ||
| 23847 | 01-31 | 1270 | ||
| 23846 | 01-31 | 232 | ||
| 23845 | 01-31 | 337 | ||
| 23844 | 01-31 | 757 | ||
| 23843 | 01-31 | 598 | ||
| 23842 | 01-31 | 264 | ||
| 23841 | 01-31 | 374 | ||
| 23840 | 01-31 | 352 | ||
| 23839 | 후 모르겠다...+18 | 01-31 | 563 | |
| 23838 | 힌트+5 | 01-31 | 666 | |
| 23837 | 01-31 | 282 | ||
| 23836 | 01-31 | 229 | ||
| 23835 | .+5 | 01-31 | 567 | |
| 23834 | 01-31 | 492 | ||
| 23833 | 01-31 | 139 |
댓글17
감사합니다!!!!!
이걸로 어케하는지 몰러
쳐 모르면 주워써
ㄳ
Local x 추가하면 되겠노
살려주십쇼
응 개헛솔~ㅋㅋㅋ 리셀러충
ㅋㅋ 신병가지고와서 리셀 드립치고잇노
으악 글 내려!!
파일명이 먼가여?
어떤스크립트를수정해야됨?
잘공부해서 써봐 ~^^
ㅇㄷ
몹 넉백으로 효과가 있음?
어떤 스크립트 바꾸면 될까요?
써본사람
아니 뭔줄 알겠는데 전에 몹넉백플라이패치인건 여기서 루아로 적용을 어캐시킴..?