Esempio n. 1
0
    public override void OnBroadcastEvent(int evnetID, int targetObjID, object args = null)
    {
        if (evnetID == (int)Const_Util.BATTLE_EVENT.RANDOM_SKILL)
        {
            BattleMsgDef.RandomSkillAward randomAward = (BattleMsgDef.RandomSkillAward)args;
            if (randomAward.playerIdx == TestConfig.RoleHeroPlayerIdx && randomSkillSprEvent == null && randomSKillID == 0)
            {
                scrollRectTr.anchoredPosition3D = new Vector3(originScrollX, 0.0f, 0.0f);
                int skillCount = DataCfgMgr.instance.GetSkillCount();
                randomSKillID = randomAward.skillID;
                int   randomSkillShowNum = randomSKillID + skillCount;
                float skillDestPosY      = (randomSkillShowNum - 1) * (randomScrollCellSize.y + randomScrollCellSpace);
                // show time
                showSkillIDCom.text     = "";//randomSKillID.ToString();
                skillBtnCG.interactable = false;

                randomSkillSprEvent = new SeqEvent();
                CanvasGroupFade fadeIn = new CanvasGroupFade(skillBtnCG, 0.0f, 1.0f, TestConfig.RandomSkillFadeInTime);
                randomSkillSprEvent.AddEvent(fadeIn);

                UIAccMoveEvent accMove = new UIAccMoveEvent(scrollRectTr, new Vector3(originScrollX, skillDestPosY, 0.0f), TestConfig.RandomSkillTime, false);
                randomSkillSprEvent.AddEvent(accMove);

                OneTimerEvent showSkillNameFunc = new OneTimerEvent(ShowRandomSkillName);
                randomSkillSprEvent.AddEvent(showSkillNameFunc);
                randomSkillSprEvent.Begin();
            }
        }
    }
    public override void  OnMsg(int msgID, object args)
    {
        if (!isActive)
        {
            return;
        }
        if (msgID == (int)Const_Util.UNIT_MSG.COLLIDER_OCCUR)
        {
            colliderCD = TestConfig.ColliderHeroHitBaseCD + TestConfig.ColliderHeroHitBaseCD * TestConfig.ColliderHeroHitCDRate * speed.y;
        }
        else if (msgID == (int)Const_Util.UNIT_MSG.GAS_ACC)
        {
            if (gasMoveEvent != null)
            {
                return;
            }
            gasMoveEvent = new SeqEvent();
            OneTimerEvent oneEvent     = new OneTimerEvent(GasMoveSpeedChgUp);
            TimerEvent    continueTime = new TimerEvent(TestConfig.NitragenStayTime + TestConfig.NitragenMoveTime);
            gasMoveEvent.AddEvent(oneEvent);
            gasMoveEvent.AddEvent(continueTime);

            OneTimerEvent moveDownEvent = new OneTimerEvent(MoveSpeedChgDown);
            TimerEvent    stayTime      = new TimerEvent(TestConfig.NitragenMoveTime);
            gasMoveEvent.AddEvent(moveDownEvent);
            gasMoveEvent.AddEvent(stayTime);
            gasMoveEvent.Begin();
        }
        else if (msgID == (int)Const_Util.UNIT_MSG.SKILL_DESC)
        {
            if (skillMoveEvent != null)
            {
                return;
            }
            mSkillHitInfo  = (BattleMsgDef.SkillHitInfo)args;
            skillMoveEvent = new SeqEvent();
            OneTimerEvent chgEvent     = new OneTimerEvent(SkillMoveSpeedChgDown);
            TimerEvent    continueTime = new TimerEvent(mSkillHitInfo.chgTime + mSkillHitInfo.continueTime);
            skillMoveEvent.AddEvent(chgEvent);
            skillMoveEvent.AddEvent(continueTime);

            OneTimerEvent resetSpeedEvent = new OneTimerEvent(SkillMoveSpeedReset);
            TimerEvent    stayTime        = new TimerEvent(mSkillHitInfo.resetTime);
            skillMoveEvent.AddEvent(resetSpeedEvent);
            skillMoveEvent.AddEvent(stayTime);
            skillMoveEvent.Begin();
        }
    }
Esempio n. 3
0
    public override void  OnMsg(int msgID, object args)
    {
        if (msgID == (int)Const_Util.UNIT_MSG.START_JUMP)
        {
            if (jumpOprEvent != null && !jumpOprEvent.IsFinish())
            {
                return;
            }
            jumpOprEvent = new SeqEvent();
            Vector3       originScale = cobj.GetRenderObjTr().localScale;
            Vector3       destScale   = originScale * 1.34f;
            ParallelEvent jumpUpPara  = new ParallelEvent();
            ScaleEvent    scaleTo     = new ScaleEvent(cobj.GetRenderObjTr(), originScale, destScale, 0.4f);
            jumpUpPara.AddEvent(scaleTo);
            SeqEvent   upEvent     = new SeqEvent();
            TimerEvent upTimeDelay = new TimerEvent(0.1f);
            upEvent.AddEvent(upTimeDelay);
            OneTimerEvent scaletoFunc = new OneTimerEvent(JumpEnough);
            upEvent.AddEvent(scaletoFunc);
            jumpUpPara.AddEvent(upEvent);

            TimerEvent timeDelay = new TimerEvent(0.8f);

            SeqEvent   downEvent     = new SeqEvent();
            TimerEvent downTimeDelay = new TimerEvent(0.1f);
            downEvent.AddEvent(downTimeDelay);
            OneTimerEvent scalebackReset = new OneTimerEvent(JumpReset);
            downEvent.AddEvent(scalebackReset);
            ParallelEvent jumpDownPara = new ParallelEvent();
            jumpDownPara.AddEvent(downEvent);
            ScaleEvent scaleBack = new ScaleEvent(cobj.GetRenderObjTr(), destScale, originScale, 0.4f);
            jumpDownPara.AddEvent(scaleBack);

            jumpOprEvent.AddEvent(jumpUpPara);
            jumpOprEvent.AddEvent(timeDelay);
            jumpOprEvent.AddEvent(jumpDownPara);

            jumpOprEvent.Begin();
        }
    }