예제 #1
0
    //检查线上的信息
    public void lineStatus()
    {
        List <Line>    lineList = magic.getLine();
        List <EDamage> edList   = magic.getMonsterATK();

        foreach (EDamage ed in edList)
        {
            if (ed.damage != 0)
            {
                foreach (Transform child in lineGameObjectlist[ed.ID].transform)
                {
                    Vector3 pos1 = child.parent.GetComponent <LineRenderer>().GetPosition(0);
                    Vector3 pos2 = child.parent.GetComponent <LineRenderer>().GetPosition(1);
                    if (child.name == "Damage")
                    {
                        child.position = new Vector3((pos1.x + pos2.x) / 2, (pos1.y + pos2.y) / 2, 0);
                        child.GetComponent <TextMesh>().text = ed.damage.ToString();
                    }
                }
            }
            else
            {
                foreach (Transform child in lineGameObjectlist[ed.ID].transform)
                {
                    child.GetComponent <TextMesh>().text = null;
                }
            }
        }
    }
예제 #2
0
    //检查线上的信息
    public void lineStatus()
    {
        List <Line>    lineList = magic.getLine();
        List <EDamage> edList   = magic.getMonsterATK();

        foreach (GameObject g in lineGameObjectlist)
        {
            g.transform.GetChild(0).GetComponent <TextMesh>().text = "";
        }

        foreach (EDamage ed in edList)
        {
            if (ed.damage != 0)
            {
                //Debug.Log(ed.ID);
                if (lineGameObjectlist.Count > 0)
                {
                    foreach (Transform child in lineGameObjectlist[ed.ID].transform)
                    {
                        Vector3 pos1 = child.parent.GetComponent <LineRenderer>().GetPosition(0);
                        Vector3 pos2 = child.parent.GetComponent <LineRenderer>().GetPosition(1);
                        if (child.name == "Damage")
                        {
                            child.position = new Vector3((pos1.x + pos2.x) / 2, (pos1.y + pos2.y) / 2, -4);
                            if (child.GetComponent <TextMesh>().text == "")
                            {
                                child.GetComponent <TextMesh>().text = ed.damage.ToString();
                            }
                            else
                            {
                                child.GetComponent <TextMesh>().text += "+" + ed.damage.ToString();
                            }
                        }
                    }
                }
            }
            //else
            //{
            //    if(lineGameObjectlist.Count > 0)
            //    foreach (Transform child in lineGameObjectlist[ed.ID].transform)
            //    {
            //        if (child.name == "Damage")
            //            //child.GetComponent<TextMesh>().text +=  null;

            //    }
            //}
        }
    }