示例#1
0
    // Update is called once per frame
    void Update()
    {
        //显示ATK
        ATK.GetComponent <Text>().text = "ATK: " + magic.getATK().ToString();
        HP.GetComponent <Text>().text  = "HP:" + magic.getHP().ToString();
        //测试monster,获取血量等
        //monster0.GetComponentInChildren<Text>().text = monster0.GetComponent<Monster>().monsterHP.ToString();
        //绘制连线颜色
        drawLineColor();

        //设定skill的内容
        skillContent();

        //设定skill的状态
        skillStatus();

        //检查线上的信息
        lineStatus();

        //设定节点位置指示器
        mPosDetect.transform.position = pointGameObjectlist[magic.getPos()].transform.position;

        //监听函数
        if (magic.getFlag() == ClickFlag.defencer)
        {
            startButton.GetComponent <Image>().color         = Color.green;
            startButton.GetComponentInChildren <Text>().text = "冥想";
        }
        else
        {
            startButton.GetComponent <Image>().color         = Color.red;
            startButton.GetComponentInChildren <Text>().text = "防御";
        }

        //检测怪物是否活着
        for (int i = 0; i < 4; ++i)
        {
            if (magic.isMonsterLive(i))
            {
                break;
            }
            if (i == 3 && !isShow)
            {
                Sprite   nowSprite   = new Sprite();
                string[] lines       = Itemtext.text.Split("\n"[0]);
                string   englishName = null;
                for (int j = 0; j < lines.Length; ++j)
                {
                    string[] parts = lines[j].Split(" "[0]);
                    if (parts[1] == Ibuff.iName.ToString())
                    {
                        englishName = parts[0];
                        break;
                    }
                }
                //foreach (Sprite sp in LoadResources.Instance.itemSp.itemSprite)
                //{
                //    if (sp.name == englishName)
                //    {
                //        nowSprite = sp;
                //    }
                //}
                nowSprite = LoadResources.Instance.itemSp.nameToSprite(englishName);
                gameOver.SetActive(true);
                GameObject.Find("tool").GetComponentInChildren <Text>().text  = Ibuff.iName.ToString();
                GameObject.Find("tool (1)").GetComponent <Image>().sprite     = nowSprite;
                GameObject.Find("skill").GetComponentInChildren <Text>().text = sklist.name.ToString();
                isShow = true;
            }
        }
        if (overCount == 0)
        {
            overCount = -1;
            MapMain.Instance.SceneEnd(true);
            canvas.SetActive(false);
        }


        //检测人物是否活着
        if (magic.getHP() <= 0)
        {
            GameObject.Find("Death").transform.localScale = new Vector3(1, 1, 1);
            Destroy(GameObject.Find("Canvas"));
            magic.initMagic();
        }


        //控制特效刷新
        EFController.Instance.Update();

        //道具查看与更新
        itemupdate();
        //更新buff
        buffupdate();

        //刷新怪物血量
        for (int i = 0; i < monsterList.transform.childCount; ++i)
        {
            if (magic.isMonsterLive(i))
            {
                monsterList.transform.GetChild(i).GetComponentInChildren <Text>().text =
                    magic.getMonsterList()[int.Parse(monsterList.transform.GetChild(i).name)].monsterHP.ToString();
            }
            else
            {
                monsterList.transform.GetChild(i).GetComponentInChildren <Text>().text = "0";
            }
        }
    }