public void InitLine() { List <Line> lineList = magic.getLine(); List <Point> Plist = magic.getPoint(); foreach (Line l in lineList) { //获取两端节点 int p1 = l.p1; int p2 = l.p2; //查询节点坐标 Vector3 pos1 = GameObject.FindGameObjectWithTag(p1.ToString()).transform.position; Vector3 pos2 = GameObject.FindGameObjectWithTag(p2.ToString()).transform.position; //生成线 linePerb.GetComponent <LineRenderer>().SetPosition(0, pos1); linePerb.GetComponent <LineRenderer>().SetPosition(1, pos2); GameObject lineP = GameObject.Instantiate(linePerb); lineP.transform.parent = lines.transform; lineP.SetActive(false); lineGameObjectlist.Add(lineP); if (Plist[p1].MaxMagic != 0 && Plist[p2].MaxMagic != 0) { lineP.SetActive(true); } } }
public void InitLine() { List <Line> lineList = magic.getLine(); List <Point> Plist = magic.getPoint(); foreach (Line l in lineList) { //获取两端节点 int p1 = l.p1; int p2 = l.p2; //查询节点坐标 Vector3 pos1 = GameObject.FindGameObjectWithTag(p1.ToString()).transform.position; Vector3 pos2 = GameObject.FindGameObjectWithTag(p2.ToString()).transform.position; //生成线 linePerb.GetComponent <LineRenderer>().SetPosition(0, pos1); linePerb.GetComponent <LineRenderer>().SetPosition(1, pos2); linePerb.GetComponentInChildren <ParticleSystem>().Pause(); GameObject lineP = GameObject.Instantiate(linePerb); lineP.transform.parent = lines.transform; lineGameObjectlist.Add(lineP); } //特效测试 for (int i = 0; i < 6; ++i) { Line l = lineList[i]; EFController.Instance.NewLineCreatAnimation(pointGameObjectlist[l.p1], pointGameObjectlist[l.p2], lineGameObjectlist[i], 0, 30); } for (int i = 6; i < 24; ++i) { Line l = lineList[i]; EFController.Instance.NewLineCreatAnimation(pointGameObjectlist[l.p1], pointGameObjectlist[l.p2], lineGameObjectlist[i], 40, 25); } for (int i = 24; i < 39; ++i) { Line l = lineList[i]; EFController.Instance.NewLineCreatAnimation(pointGameObjectlist[l.p1], pointGameObjectlist[l.p2], lineGameObjectlist[i], 75, 20); } EFController.Instance.NewRingCreatAnimation(nodes.transform.GetChild(0).gameObject, 105, 25, 0.95f, 0.8f); //if(magic.getPoint(16).MaxMagic > 0 || magic.getPoint(17).MaxMagic > 0 || magic.getPoint(18).MaxMagic > 0) EFController.Instance.NewRingCreatAnimation(nodes.transform.GetChild(1).gameObject, 100, 25, 2.4f, 0.8f); }
// Use this for initialization void Start() { magic = MagicCore.Instance; lineGameObjectlist = new List <GameObject>(); pointGameObjectlist = new List <GameObject>(); instance = node; lineList = magic.getLine(); Plist = magic.getPoint(); //初始化节点位置 InitPointPos(); //初始化连线 InitLine(); //初始化花纹 InitFigure(); }