//鼠标悬停事件(基于碰撞体) void OnMouseOver() { if (Clickcontrol.isDrag) { magic.drag(int.Parse(this.tag)); } if (Input.GetMouseButton(1)) { magic.RclickP(int.Parse(this.tag)); } }
// Update is called once per frame void Update() { magic = MagicCore.Instance; pList = magic.getPoint(); pointStatus(); //判断状态,确定节点是否显示,以及其魔力值等 if (magic.getPoint(int.Parse(this.tag)).MaxMagic == 0) { this.GetComponent <SpriteRenderer>().sprite = null; } else if (!magic.getPointBroked(int.Parse(this.tag))) { this.GetComponentInChildren <TextMesh>().text = magic.getPoint(int.Parse(this.tag)).magic + "/" + magic.getPoint(int.Parse(this.tag)).MaxMagic; this.GetComponent <SpriteRenderer>().sprite = oldSprite; } //节点颜色初始化 this.GetComponent <SpriteRenderer>().color = toPointColor(magic.getPointColor(int.Parse(this.tag))); if (magic.isDefencer(int.Parse(this.tag))) { this.GetComponent <SpriteRenderer>().color = Color.gray; } //当前节点变大 if (magic.getPos() == int.Parse(this.tag)) { this.transform.localScale = new Vector3(5, 5, 0); } else { this.transform.localScale = new Vector3(3, 3, 0); } //空白处按右键,取消所有操作 if (Input.GetMouseButton(1) && Clickcontrol.isDrag) { magic.RclickP(-1); Clickcontrol.isDrag = false; } }
//鼠标悬停事件(基于碰撞体) void OnMouseOver() { if (Clickcontrol.isDrag) { if (magic.drag(int.Parse(this.tag))) { //添加转换特效 //判断是否是添加第一个节点 //if (MagicCore.Instance.getRoute().Count == 1) //{ // GameObject.Find("MagicEventSystem").GetComponent<Clickcontrol>().newLineTransfer(false,true,PointColor.white); //} //else //{ GameObject.Find("MagicEventSystem").GetComponent <Clickcontrol>().newLineTransfer(true); //} } } if (Input.GetMouseButton(1)) { magic.RclickP(int.Parse(this.tag)); } }
// 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; } }