欢迎光临散文网 会员登陆 & 注册

jass基础-计时器刷怪

2023-07-04 00:30 作者:庞各庄大棚  | 我要投稿

// 计时器刷怪

library demo initializer test

    globals

        timer tm

        timerdialog td

        real refTime = 5

        integer curWave = 1

        integer array monsterArr

        integer array monsterCount

        real in = 0.5

        real refX = 1000

        real refY = 1000

        real homeX = 0

        real homeY = 0

        integer curCount = 0

    endglobals

    function refMonster takes nothing returns nothing

        local unit u

        if curCount < monsterCount[curWave] then

            set u = CreateUnit(Player(1), monsterArr[curWave], refX, refY, 0)

            call IssuePointOrder(u, "attack", homeX, homeY)

            set curCount = curCount + 1

        else

            call PauseTimer(tm)

            set curWave = curWave + 1

            if monsterArr[curWave] == 0 then

                call DestroyTimer(tm)

                call DestroyTimerDialog(td)

                return

            endif

            set curCount = 0

            call ExecuteFunc("bbb")

        endif

    endfunction

    function ref takes nothing returns nothing

        call TimerStart(tm, in, true, function refMonster)

    endfunction

    function bbb takes nothing returns nothing

        call TimerDialogDisplay(td, true)

        call TimerStart(tm, refTime, false, function ref)

        call TimerDialogSetTitle(td, "第" + I2S(curWave) + "波:")

    endfunction

    function aaa takes nothing returns nothing

        set tm = CreateTimer()

        set td = CreateTimerDialog(tm)

        call bbb()

    endfunction

    function test takes nothing returns nothing

        local trigger t = CreateTrigger()

        call TriggerRegisterTimerEventSingle(t, 1)

        call TriggerAddAction(t, function aaa)

        call FogEnable(false)

        call FogMaskEnable(false)

        set monsterArr[1] = 'hfoo'

        set monsterArr[2] = 'hkni'

        set monsterArr[3] = 'hrif'

        set monsterCount[1] = 5

        set monsterCount[2] = 6

        set monsterCount[3] = 7

    endfunction

endlibrary

jass基础-计时器刷怪的评论 (共 条)

分享到微博请遵守国家法律