채팅0

    뿌린다 1ㄷ1 ㄴㄴ

    조회수 998

    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

    댓글17

    회원프로필

    감사합니다!!!!!

    2024.01.31 17:53
    회원프로필

    이걸로 어케하는지 몰러

    2024.01.31 17:53
    회원프로필

    쳐 모르면 주워써

    2024.01.31 17:54
    회원프로필

    2024.01.31 17:53
    회원프로필

    Local x 추가하면 되겠노

    2024.01.31 17:53
    회원프로필

    살려주십쇼

    2024.01.31 17:54
    회원프로필

    응 개헛솔~ㅋㅋㅋ 리셀러충

    2024.01.31 17:54
    회원프로필

    ㅋㅋ 신병가지고와서 리셀 드립치고잇노

    2024.01.31 17:55
    회원프로필

    으악 글 내려!!

    2024.01.31 17:54
    회원프로필

    파일명이 먼가여?

    2024.01.31 17:56
    회원프로필

    어떤스크립트를수정해야됨?

    2024.01.31 17:56
    회원프로필

    잘공부해서 써봐 ~^^

    2024.01.31 17:56
    회원프로필

    ㅇㄷ

    2024.01.31 17:56
    회원프로필

    몹 넉백으로 효과가 있음?

    2024.01.31 17:58
    회원프로필

    어떤 스크립트 바꾸면 될까요?

    2024.01.31 18:03
    회원프로필

    써본사람

    2024.01.31 18:06
    회원프로필

    아니 뭔줄 알겠는데 전에 몹넉백플라이패치인건 여기서 루아로 적용을 어캐시킴..?

    2024.01.31 18:09

      게시글 리스트
      제목작성자작성일조회
      2385201-31375
      2385101-31882
      2385001-31228
      2384901-31999
      2384801-31250
      23847
      ~!~파일+7
      01-311270
      2384601-31232
      2384501-31337
      2384401-31757
      2384301-31598
      2384201-31264
      2384101-31374
      2384001-31352
      2383901-31563
      2383801-31666
      2383701-31282
      2383601-31229
      23835
      .+5
      01-31567
      2383401-31492
      2383301-31139
      안내 배너 이미지