// Update is called once per frame void Update() { //显示ATK和DEF ATK.GetComponent <Text>().text = "ATK: " + magic.getATK().ToString(); DEF.GetComponent <Text>().text = "DEF: " + magic.getDEF().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(); //监听函数 if (magic.getFlag() == ClickFlag.defencer) { startButton.GetComponent <Image>().color = Color.green; } else { startButton.GetComponent <Image>().color = Color.red; } //说明框位置跟随 showState.transform.position = new Vector3((int)Input.mousePosition.x - (int)width * showState.transform.localScale.x / 2 + 0.1f, (int)Input.mousePosition.y + (int)height * showState.transform.localScale.y / 2 + 0.1f, 0); //检测怪物是否活着 for (int i = 0; i < 4; ++i) { if (magic.isMonsterLive(i)) { break; } if (i == 3 && !isShow) { gameOver.SetActive(true); GameObject.Find("tool").GetComponentInChildren <Text>().text = Ibuff.iName.ToString(); isShow = true; } } if (overCount == 0) { overCount = -1; MapMain.Instance.SceneEnd(true); canvas.SetActive(false); } }
//鼠标按下事件(基于碰撞体) void OnMouseDown() { if (magic.getCurrentPos() == int.Parse(this.tag) && magic.getFlag() == ClickFlag.normal) { Clickcontrol.isDrag = true; } }
// Update is called once per frame void Update() { magic = MagicCore.Instance; pList = magic.getPoint(); //判断状态,确定节点是否显示,以及其魔力值等 if (magic.getPoint(int.Parse(this.tag)).MaxMagic == 0) { this.GetComponent <SpriteRenderer>().sprite = null; } else if (!magic.getPointBroked(int.Parse(this.tag))) { this.transform.GetChild(0).GetComponent <TextMesh>().text = magic.getPoint(int.Parse(this.tag)).magic.ToString(); if (magic.getPoint(int.Parse(this.tag)).isProtected) { this.transform.GetChild(0).GetComponent <TextMesh>().color = Color.blue; } else { this.transform.GetChild(0).GetComponent <TextMesh>().color = Color.white; } this.GetComponent <SpriteRenderer>().sprite = oldSprite; } pointStatus(); //节点颜色初始化 this.GetComponent <SpriteRenderer>().color = toPointColor(magic.getPointColor(int.Parse(this.tag))); if (magic.getPoint(int.Parse(this.tag)).isActivity) { if (magic.getPointColor(int.Parse(this.tag)) == PointColor.black) { this.transform.GetChild(1).localScale = new Vector3(0.05f, 0.05f, 0); } if (magic.getPointColor(int.Parse(this.tag)) == PointColor.blue) { this.transform.GetChild(2).localScale = new Vector3(0.05f, 0.05f, 0); } if (magic.getPointColor(int.Parse(this.tag)) == PointColor.red) { this.transform.GetChild(3).localScale = new Vector3(0.05f, 0.05f, 0); } if (magic.getPointColor(int.Parse(this.tag)) == PointColor.white) { this.transform.GetChild(4).localScale = new Vector3(0.05f, 0.05f, 0); } if (magic.getPointColor(int.Parse(this.tag)) == PointColor.yellow) { this.transform.GetChild(5).localScale = new Vector3(0.05f, 0.05f, 0); } } else { this.transform.GetChild(1).localScale = new Vector3(0, 0, 0); this.transform.GetChild(2).localScale = new Vector3(0, 0, 0); this.transform.GetChild(3).localScale = new Vector3(0, 0, 0); this.transform.GetChild(4).localScale = new Vector3(0, 0, 0); this.transform.GetChild(5).localScale = new Vector3(0, 0, 0); } if (magic.isDefencer(int.Parse(this.tag))) { this.GetComponent <SpriteRenderer>().color = Color.gray; } if (magic.getFlag() != ClickFlag.wait) { ////当前节点变大 //if (magic.getPos() == int.Parse(this.tag)) // this.transform.localScale = new Vector3(3, 3, 0); //else // this.transform.localScale = new Vector3(2, 2, 0); } //空白处按右键,取消所有操作 if (Input.GetMouseButton(1) && Clickcontrol.isDrag) { magic.RclickP(-1); Clickcontrol.isDrag = false; } }
// 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"; } } }