示例#1
0
 void OnokSkillBtn(Transform panel)
 {
     MusicManager.PlaySe("click");
     if (BattleGlobals.currentSid != "")
     {
         Skill s = GameFuncs.GetSkill(BattleGlobals.currentSid);
         Hero  h = BattleGlobals.currentObj.GetComponent <Hero>();
         if ((!s.isCp && h.currentMp >= s.cost) || (s.isCp && h.cp >= s.cost))//可消耗
         {
             BattleCamera.SetAnimStop();
             skillPanel.SetActive(false);
             heroPanel.SetActive(false);
             if (!s.isAoe)//单体
             {
                 BattleGlobals.isSelectEnemy = true;
             }
             else
             {
                 BattleCamera.Instance.SetPos(0);
                 BattleGlobals.currentObj.GetComponent <Hero>().Magic(BattleGlobals.currentSid);
             }
             foreach (Transform so in panel.Find("list/grid"))
             {
                 Destroy(so.gameObject);
             }
             BattleGlobals.isMagic = true;
         }
         else//mp(cp)不足
         {
             string msg = (s.isCp ? "cp" : "mp") + "不足!";
             GameFuncs.CreateMsg(msg);
         }
     }
 }
示例#2
0
    public virtual void Magic(string sid, Entity other = null)
    {
        Skill      s      = GameFuncs.GetSkill(sid);
        Hero       h      = BattleGlobals.currentObj.GetComponent <Hero>();
        GameObject effect = Instantiate((GameObject)GameFuncs.GetResource("Effect/" + sid));

        Destroy(effect, 2);
        BattleCamera.Shake();
        int   cost  = s.isCp ? s.cost : s.cost / 5;
        float ats   = s.isCp ? h.infos[4] : (h.infos[2] + h.infos[4]) / 2;
        float value = cost * ats;

        if (s.isAoe)
        {
            if (BattleGlobals.currentObj.tag == "Hero")
            {
                effect.transform.position = Battle.mone.position;
                List <string> temp = new List <string>();
                foreach (string lm in BattleGlobals.liveMonsters)
                {
                    temp.Add(lm);
                }
                for (int i = 0; i < temp.Count; i++)
                {
                    string es = temp[i];
                    Enemy  en = BattleFuncs.FindObj(es).GetComponent <Enemy>();
                    en.GetHurt(value, GetRestrict(en, ref value));
                }
            }
            else if (BattleGlobals.currentObj.tag == "Enemy")
            {
                List <string> temp = BattleGlobals.liveHeroes;
                for (int i = 0; i < temp.Count; i++)
                {
                    string hs = temp[i];
                    Hero   he = BattleFuncs.FindObj(hs).GetComponent <Hero>();
                    he.GetHurt(value, GetRestrict(he, ref value));
                }
            }
        }
        else
        {
            effect.transform.position = other.gameObject.transform.position;
            other.GetHurt(value, GetRestrict(other, ref value));
        }
        BattleGlobals.currentSid = "";
        Invoke("SetTurnOver", 2);
    }
示例#3
0
    /// <summary>
    /// 初始化Globals.heroList
    /// </summary>
    public static void InitHeroList()
    {
        SqlDataReader dr = DBHelper.Select("select * from HeroList");

        while (dr.Read())
        {
            int[] tempinfos = new int[6] {
                (int)dr["hp"], (int)dr["mp"], (int)dr["atk"], (int)dr["def"], (int)dr["ats"], (int)dr["spd"],
            };
            Skill ss = GameFuncs.GetSkill((string)dr["superSkill"]);
            Hero  h  = new Hero((string)dr["id"], (string)dr["ename"], (string)dr["imagePath"], (string)dr["ele"],
                                tempinfos, (int)dr["isNearAttack"] == 1 ? true : false, ss);
            Globals.heroList.Add(h);
        }
        DBHelper.Closedr(dr);
    }
示例#4
0
    public override void Magic(string sid, Entity other = null)
    {
        BattleGlobals.isNearAttack = false;
        if (sid == "")
        {
            return;
        }
        Skill s = GameFuncs.GetSkill(sid);

        if (!s.isCp)
        {
            currentMp     -= s.cost;
            mpSlider.value = (float)currentMp / infos[1];
            mpText.text    = currentMp.ToString() + "/" + infos[1].ToString();
        }
        else
        {
            cp -= s.cost;
            if (cp <= 0)
            {
                cp = 0;
            }
            cpSlider.value = (float)cp / 100;
            cpText.text    = cp.ToString() + "/100";
        }
        anim.SetTrigger("magic");
        if (s.isCp)
        {
            MusicManager.PlayVoice(id + "_magic");
        }
        else
        {
            MusicManager.PlayVoice(id + "_skill");
        }
        base.Magic(sid, other);
    }