Exemplo n.º 1
0
    /// <summary>
    /// 结束绝技过程
    /// </summary>
    public void EndSkill()
    {
        if (!isUsing)
        {
            return;
        }
        isUsing = false;

        FightEnergy.instance.EnergyUseVal -= (int)specialSkillLvUp.EnergyCost;

        //把英雄头像ui放回
        HeroFightUnit unit = (HeroFightUnit)mineUnit;

        ViewMapper <FightPanel> .instance.BringBackHeadShot(unit);

        if (isMagicing)
        {
            //减少黑幕
            FightEffectManager.instance.MinusOne();
            //把人物放回原层
            FightEffectManager.instance.BringBack(mineUnit);
            isMagicing = false;
        }

        if (cachedEffect != null)
        {
            Destroy(cachedEffect);
        }

        StopAllCoroutines();
        OnNone();
    }
Exemplo n.º 2
0
 public void ShowHeroState(HeroFightUnit hero)
 {
     healthBar.value = hero.healthValue;
     manaBar.value   = hero.manaValue;
     if (healthBar.value <= 0.2)
     {
         healthBar.foregroundWidget.color = Color.red;
     }
     else if (healthBar.value > 0.2 && healthBar.value <= 0.5)
     {
         healthBar.foregroundWidget.color = new Color(1f, 0.75f, 0f, 1f);
     }
     if (hero.attack != null)
     {
         HeroAttack attack = (HeroAttack)hero.attack;
         if (attack.normalSkill.time != 0)
         {
             cdlabel.text = Mathf.RoundToInt(attack.normalSkill.time).ToString();
         }
         else
         {
             cdlabel.text = string.Empty;
         }
     }
     if (HeadshotIcon.color.g == 0f && count == 3)
     {
         HeadshotIcon.color = Color.white;
         count = 0;
     }
     else if (HeadshotIcon.color.g == 0f)
     {
         count++;
     }
 }
Exemplo n.º 3
0
    public override void DoSkill()
    {
        if (isUsing)
        {
            return;
        }
        isUsing = true;
        FightEnergy.instance.EnergyUseVal += (int)specialSkillLvUp.EnergyCost;

        //把英雄头像ui上拉
        HeroFightUnit unit = (HeroFightUnit)mineUnit;

        ViewMapper <FightPanel> .instance.BringForewardHeadShot(unit);

        //增加黑幕
        FightEffectManager.instance.AddOne();
        //把人物放在变亮层
        FightEffectManager.instance.BringForeward(mineUnit);
        isMagicing = true;

        if (specialSkill.actionLimit != 1)
        {
            StartCoroutine(StartPreSkill());
        }
        else
        {
            StartCoroutine(StartChixuSkill());
        }

        //记录使用次数
        DungeonRecord.uniqueSkillCount++;
    }
Exemplo n.º 4
0
 void UpdateHeadShot()
 {
     foreach (var element in HeadShotMapper)
     {
         HeroFightUnit  unit = element.Key;
         HeadShotWidget ui   = element.Value;
         ui.ShowHeroState(unit);
     }
 }
Exemplo n.º 5
0
    public override void Init()
    {
        self = GetComponent <HeroFightUnit>();
        /* 自动使用技能,当处于自动战斗或者混乱状态下 */
        self.OnNoramlAttackFinish += ThinkUseSkill;
        /*普通攻击初始化*/
        normalAttack        = NGUITools.AddChild <NormalAttack>(gameObject);
        normalAttack.attack = Util.GetDic <MsgAttackData, AttackData>()[normalAttackId];
        JsonData castEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.castEffect));

        for (int i = 0; i < castEffectDt.Count; i++)
        {
            normalAttack.castEffectIds.Add((int)castEffectDt[i]);
        }
        JsonData flyEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.flyEffect));

        for (int i = 0; i < flyEffectDt.Count; i++)
        {
            normalAttack.flyEffectIds.Add((int)flyEffectDt[i]);
        }
        JsonData hitEffectDt = JsonMapper.ToObject(Util.GetConfigString(normalAttack.attack.hitEffect));

        for (int i = 0; i < hitEffectDt.Count; i++)
        {
            normalAttack.hitEffectIds.Add((int)hitEffectDt[i]);
        }
        normalAttack.mineUnit = self;
        normalAttack.Init();
        /*主动技能初始化*/
        normalSkill             = NGUITools.AddChild <ActiveSkill>(gameObject);
        normalSkill.normalSkill = Util.GetDic <MsgNormalSkill, NormalSkill>()[normalSkillId];
        int LvUpId = normalSkillId * 100 + normalSkillLv;

        normalSkill.normalSkillLvUp = Util.GetDic <MsgNormalSkillLvUp, NormalSkillLvUp>()[LvUpId];
        normalSkill.dmgEffectId     = (int)normalSkill.normalSkill.dmgEffect;
        normalSkill.castEffectId    = (int)normalSkill.normalSkill.castEffect;
        normalSkill.flyEffectId     = (int)normalSkill.normalSkill.flyEffect;
        normalSkill.hitEffectId     = (int)normalSkill.normalSkill.hitEffect;
        normalSkill.mineUnit        = self;
        normalSkill.Init();
        /*绝技初始化*/
        specailSkill = NGUITools.AddChild <UniqueSkill>(gameObject);
        specailSkill.specialSkill = Util.GetDic <MsgSpecialSkill, SpecialSkill>()[specailSkillId];
        int specailLvId = specailSkillId * 100 + specailSkillLv;

        specailSkill.specialSkillLvUp = Util.GetDic <MsgSpecialSkillLvUp, SpecialSkillLvUp>()[specailLvId];
        specailSkill.castEffectId     = (int)specailSkill.specialSkill.castEffect;
        specailSkill.dmgEffectId      = (int)specailSkill.specialSkill.dmgEffect;
        specailSkill.flyEffectId      = (int)specailSkill.specialSkill.flyEffect;
        specailSkill.hitEffectId      = (int)specailSkill.specialSkill.hitEffect;
        specailSkill.mineUnit         = self;
        specailSkill.Init();
        /*队长技能初始化*/

        CEventDispatcher.GetInstance().AddEventListener(CEventType.MOVE_TO_NEXT, ResetAutoState);
    }
Exemplo n.º 6
0
    void UpdateHeadShot()
    {
        foreach (var element in HeadShotMapper)
        {
            HeroFightUnit unit = element.Key;
//			Debug.Log ("!!!!!!!!!!!!" + unit.name);
            HeadShotWidget ui = element.Value;
            ui.ShowHeroState(unit);
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 替换头像控件绑定
    /// </summary>
    /// <param name="oldHero"></param>
    /// <param name="newHero"></param>
    public void ReplaceHeadShot(HeroFightUnit oldHero, HeroFightUnit newHero)
    {
        HeadShotWidget headShot = HeadShotMapper[oldHero];

        HeadShotMapper.Remove(oldHero);
        HeadShotMapper.Add(newHero, headShot);
        headShot.HeadshotIcon.spriteName = Util.GetConfigString(newHero.heroData.icon);
        headShot.SetShuxing((HurtType)newHero.heroData.element);
        HeroAttack attack = newHero.GetComponent <HeroAttack>();

        headShot.onClick = attack.UI_UseActiveSkill;
        headShot.onDrag  = attack.UI_UseUniqueSkill;
    }
Exemplo n.º 8
0
    /// <summary>
    /// 绑定英雄头像控件
    /// </summary>
    /// <param name="unit"></param>
    /// <param name="i"></param>
    public void RegesterHeadShot(HeroFightUnit unit, int i)
    {
        string         key      = i + HeadShotWidget.nameExtension;
        HeadShotWidget headShot = (HeadShotWidget)widgetsMap[key];

        HeadShotMapper.Add(unit, headShot);
        headShot.HeadshotIcon.spriteName = Util.GetConfigString(unit.heroData.icon);
        headShot.SetShuxing((HurtType)unit.heroData.element);
        HeroAttack attack = unit.GetComponent <HeroAttack>();

        headShot.onClick = attack.UI_UseActiveSkill;
        headShot.onDrag  = attack.UI_UseUniqueSkill;
        headShot.gameObject.SetActive(true);
    }
Exemplo n.º 9
0
 public void ShowHeroState(HeroFightUnit hero)
 {
     healthBar.value = hero.healthValue;
     manaBar.value   = hero.manaValue;
     if (hero.attack != null)
     {
         HeroAttack attack = (HeroAttack)hero.attack;
         if (attack.normalSkill.time != 0)
         {
             cdlabel.text = Mathf.RoundToInt(attack.normalSkill.time).ToString();
         }
         else
         {
             cdlabel.text = string.Empty;
         }
     }
 }
Exemplo n.º 10
0
    /// <summary>
    /// 实例化所有作战单位
    /// </summary>
    public void InstUnits()
    {
        HealthUIManager.instance.ResetDepth();
        for (int i = 0; i < PlayerData.GetInstance().CurrentFightHero.Count; i++)
        {
            int        id            = PlayerData.GetInstance().CurrentFightHero[i];
            string     heroModelName = Encoding.Default.GetString(heroDataDic[id].model);
            GameObject child         = AssetManager.GetGameObject(heroModelName, battle_points[i]);
            if (heroDataDic[id].direction == 1)
            {
                child.transform.Rotate(new Vector3(0, 180, 0));
            }
            child.transform.parent = transform.parent;
            child.layer            = gameObject.layer;
            unit = child.AddComponent <HeroFightUnit>();
            fightUnits.Add(unit);
            unit.parentGroup = this;
            unit.orinPoint   = battle_points[i];
            //赋值战斗属性
            unit.heroData      = heroDataDic[id];
            unit.heroEvolution = heroEvolution[110]; //假定品质1,星级0
            unit.level         = 1;                  //假定等级是1
            unit.InitFightAttribute();
            //赋值技能id
            HeroAttack heroAttack = child.GetComponent <HeroAttack>();
            heroAttack.normalAttackId = (int)heroDataDic[id].attackID;
            heroAttack.normalSkillId  = (int)heroDataDic[id].normalSkill;
            heroAttack.specailSkillId = (int)heroDataDic[id].specialSkill;
            //生成血条UI
            Transform healthBarPos = child.transform.Find("blood");
            HealthUIManager.instance.AddNewHealthBar(fightUnits[i], healthBarPos, group == GroupType.Enemy);
            //绑定人物头像
            ViewMapper <FightPanel> .instance.RegesterHeadShot(unit, i);

            unit.OnGotHit += OnHeadPicShake;
            anim           = ViewMapper <FightPanel> .instance.HeadShotMapper[unit].anim_headpic;
            headcolor      = ViewMapper <FightPanel> .instance.HeadShotMapper [unit].headcolor;
            //记录初始数值
            DungeonRecord.totalHp += unit.fightAttribute.health;
        }

        /* 赋值备战单位
         * 记录初始数值*/
    }
Exemplo n.º 11
0
    /// <summary>
    /// 头像拉上
    /// </summary>
    /// <param name="hero"></param>
    public void BringForewardHeadShot(HeroFightUnit hero)
    {
        HeadShotWidget headShot = HeadShotMapper[hero];

        headShot.BringForeward();
    }
Exemplo n.º 12
0
    /// <summary>
    /// 头像回退
    /// </summary>
    /// <param name="hero"></param>
    public void BringBackHeadShot(HeroFightUnit hero)
    {
        HeadShotWidget headShot = HeadShotMapper[hero];

        headShot.BringBack();
    }
Exemplo n.º 13
0
 public void RemoveCombo(HeroFightUnit hero)
 {
     hero.OnSkillHit -= AddCombo;
 }
Exemplo n.º 14
0
 public void RegesterCombo(HeroFightUnit hero)
 {
     hero.OnSkillHit += AddCombo;
 }