Beispiel #1
0
    private void RefreshUI()
    {
        switch (endType)
        {
        case FubenEndType.Pause:
            SetActive(rewardTrans, false);
            SetActive(btnExit.gameObject);
            SetActive(btnClose.gameObject);
            break;

        case FubenEndType.Win:
            SetActive(rewardTrans, false);
            SetActive(btnExit.gameObject, false);
            SetActive(btnClose.gameObject, false);

            int min    = costTime / 60;
            int second = costTime % 60;
            SetText(txtTime, "通关时间 :" + min + ":" + second);
            SetText(txtRestHP, "剩余血量 :" + restHP);
            //嵌套播放结算界面的音效
            timeSvc.AddTimeTask((int tid) =>
            {
                SetActive(rewardTrans);
                audioSvc.PlayUIAudio(Constants.FBItemEnter);
                timeSvc.AddTimeTask((int tid1) =>
                {
                    audioSvc.PlayUIAudio(Constants.FBItemEnter);
                    timeSvc.AddTimeTask((int tid2) =>
                    {
                        audioSvc.PlayUIAudio(Constants.FBItemEnter);
                        timeSvc.AddTimeTask((int tid3) =>
                        {
                            audioSvc.PlayUIAudio(Constants.FBItemEnter);
                            timeSvc.AddTimeTask((int tid4) =>
                            {
                                audioSvc.PlayUIAudio(Constants.FBWin);
                            }, 0.1f);
                        }, 0.27f);
                    }, 0.27f);
                }, 0.325f);
            }, 1f);
            break;

        case FubenEndType.Lose:
            SetActive(rewardTrans, false);
            SetActive(btnExit.gameObject);
            SetActive(btnClose.gameObject, false);
            audioSvc.PlayUIAudio(Constants.FBLose);

            break;
        }
    }
Beispiel #2
0
    /// <summary>
    /// 技能效果表现
    /// </summary>
    /// <param name="entity">。。。</param>
    /// <param name="skillID"></param>
    public void AttackEffect(EntityBase entity, int skillID, Vector3 blackAirPos)
    {
        SkillCfg skillData = resSvc.GetSkillCfgData(skillID);

        //分技能类型调整角色行为
        if (entity.entityType == EntityType.Player)
        {
            /*如果是指向技能,自动转向最近目标,如果是范围技能,朝向区域方向,
             *如果是辅助技能,方向不变,闪避技能被设定为指向技能,因为永远朝向
             *目标并且背向移动*/
            if (skillData.dmgType == DamageType.TargetSkill)
            {
                Vector2 dir = entity.CalculateTargetDir();
                if (dir != Vector2.zero)
                {
                    entity.SetAtkRotation(dir);
                }
            }
            else if (skillData.dmgType == DamageType.AreaSkill)
            {
                Vector2 dir = entity.AreaSkillTargetDir();
                if (dir != Vector2.zero)
                {
                    entity.SetAtkRotation(dir);
                }
                //如果是范围技能,且不是瞬移,在动画播放快结束的时候播放对应延迟特效,持续时间后消失。
                if (skillData.ID != Constants.id_PlayerSkill_Blink)
                {
                    entity.SetAreaSkillFX(skillData.targetFX, skillData.delayFXTime, skillData.delayCloseFXTime);
                }
            }
            else//辅助技能
            {
                if (skillData.ID == Constants.id_PlayerSkill_Heal)//治疗技能
                {
                    entity.Hp += GameRoot.instance.Playerdata.hp / 3;
                    if (entity.Hp > GameRoot.instance.Playerdata.hp)
                    {
                        entity.Hp = GameRoot.instance.Playerdata.hp;
                    }
                }
                else if (skillData.ID == Constants.id_PlayerSkill_Buff)//状态技能,攻击力+50%,进入霸体状态
                {
                    entity.AttackValue += GameRoot.instance.Playerdata.attackValue / 2;
                    entity.unBreakable  = true;
                    TimeService.instance.AddTimeTask((int tid) =>
                    {
                        entity.AttackValue -= GameRoot.instance.Playerdata.attackValue / 2;
                        entity.unBreakable  = false;
                    }, 15f);
                }
            }
            //这里分开的目的是,玩家的部分技能也有延迟时间,但是是另一种特效,不能统一显示
            entity.SetFX(skillData.fx, skillData.skillFXTime);
        }
        else//不是玩家,实际上这部分代码指的是boss的技能表现
        {
            if (skillData.dmgType == DamageType.AreaSkill)
            {
                entity.SetLoopSkill(skillData.fx, blackAirPos);
            }
            entity.SetFX(skillData.fx, skillData.skillFXTime, skillData.delayFXTime);
        }
        entity.SetAction(skillData.aniAction);

        if (skillData.cantStop)
        {
            entity.cantStop = true;
        }
        SkillMoveCfg skillMoveCfg = resSvc.GetSkillMoveCfgData(skillData.skillMove);
        float        speed        = 0;

        if (skillData.ID == Constants.id_PlayerSkill_Blink)//是瞬移技能,不是闪避
        {
            float dis = Vector3.Distance(entity.GetPos(), BattleSys.Instance.playerCtrlWnd.pos);
            speed = dis / (skillMoveCfg.moveTime / 1000f);
            entity.SetSkillMoveState(true, false, false, speed);
        }
        else if (skillData.ID == Constants.id_PlayerSkill_Dodge)            //闪避技能
        {
            speed = skillMoveCfg.moveDis / (skillMoveCfg.moveTime / 1000f); //单位是毫秒
            entity.SetSkillMoveState(true, true, false, speed);
        }
        else if (skillData.ID == Constants.id_BossSkill_bladeStorm)         //剑刃风暴,理论上来说可以和闪避技能公用代码
        {
            speed = skillMoveCfg.moveDis / (skillMoveCfg.moveTime / 1000f); //单位是毫秒
            entity.SetSkillMoveState(true, true, false, speed);
        }
        else if (skillData.ID == Constants.id_BossSkill_sifangzhen)//四方斩技能要位移到场地中间
        {
            float dis = Vector3.Distance(entity.GetPos(), Constants.sifangzhanPos);
            speed = dis / (skillMoveCfg.moveTime / 1000f);
            entity.SetSkillMoveState(true, false, true, speed);
        }
        timeSvc.AddTimeTask((int tid) =>
        {//技能移动时间到就设置为不能移动
            entity.SetSkillMoveState(false);
        }, skillMoveCfg.moveTime / 1000f);
        timeSvc.AddTimeTask((int tid) =>
        {
            entity.Idle();

            /*不能直接在这里修改action的值是因为,这个攻击可能会被打断,被打断以后不会进入这个状态
             * 这样就无法设置action了,所以是在退出攻击状态的时候设置action*/
        }, skillData.animationTime);
    }