3192人加入学习
(59人评价)
《暗黑战神》3D网游ARPG实战案例(第一季)(Unity 2017.3)
价格 ¥ 450.00
该课程属于 Unity - A计划(一年有效期) 请加入后再学习

教程中关于comboIndex归零的处理太麻烦,而且会丢失一次点击响应,我的代码很简单:

public void ReleaseNormalAtk()
    {
        if(entitySelfPlayer.currentAniState==AniState.Attack)
        {
            //在500ms内进行第二次点击,存数据
            double nowAtkTime = TimerSvc.Instance.GetNowTime();
            if(nowAtkTime-lastAtkTime<Constants.ComboSpace&&lastAtkTime!=0)
            {

                //索引自动归零
                comboIndex =(comboIndex+1)%comboArr.Length;
                entitySelfPlayer.comboQue.Enqueue(comboArr[comboIndex]);
                lastAtkTime = nowAtkTime;
            }
        }
        else if(entitySelfPlayer.currentAniState==AniState.Idle||entitySelfPlayer.currentAniState==AniState.Move)
        {
            lastAtkTime = TimerSvc.Instance.GetNowTime();
            entitySelfPlayer.Attack(comboArr[0]);
        }

        
        PECommon.Log("Click Normal Attack");
    }

[展开全文]

授课教师

PlaneZhong

课程特色

图文(1)
视频(289)