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
| 제목 | 작성자 | 작성일 | 조회 | |
|---|---|---|---|---|
| 공지 | 게시판 이용 안내+156 | 10-20 | 22381 | |
| 61792 | 12-28 | 130 | ||
| 61791 | 12-28 | 208 | ||
| 61790 | 12-26 | 490 | ||
| 61789 | 12-25 | 609 | ||
| 61788 | 12-25 | 574 | ||
| 61787 | 12-24 | 864 | ||
| 61786 | 12-23 | 1190 | ||
| 61785 | 12-22 | 1205 | ||
| 61784 | 12-22 | 1339 | ||
| 61783 | 12-22 | 1178 | ||
| 61782 | 12-21 | 1255 | ||
| 61781 | 12-21 | 1416 | ||
| 61780 | 12-21 | 1336 | ||
| 61779 | 12-19 | 1535 | ||
| 61778 | 12-18 | 1629 | ||
| 61777 | 12-18 | 2227 | ||
| 61776 | 12-16 | 2141 | ||
| 61775 | 12-14 | 2232 | ||
| 61774 | 12-14 | 2612 |
댓글17
감사합니다!!!!!
이걸로 어케하는지 몰러
쳐 모르면 주워써
ㄳ
Local x 추가하면 되겠노
살려주십쇼
응 개헛솔~ㅋㅋㅋ 리셀러충
ㅋㅋ 신병가지고와서 리셀 드립치고잇노
으악 글 내려!!
파일명이 먼가여?
어떤스크립트를수정해야됨?
잘공부해서 써봐 ~^^
ㅇㄷ
몹 넉백으로 효과가 있음?
어떤 스크립트 바꾸면 될까요?
써본사람
아니 뭔줄 알겠는데 전에 몹넉백플라이패치인건 여기서 루아로 적용을 어캐시킴..?