public List <Vector3> GetBPlist(BattleRoleType type)
 {
     if (bpList.ContainsKey(type))
     {
         return(bpList[type]);
     }
     return(new List <Vector3>());
 }
Exemple #2
0
    public List <Vector3> GetBpList(BattleRoleType type)
    {
        List <Vector3> result = new List <Vector3>();
        string         pbroot = Define.GetRootName(type);
        Transform      bproot = this.transform.FindChild(pbroot);

        if (bproot != null)
        {
            for (int i = 0; i < bproot.childCount; i++)
            {
                result.Add(bproot.GetChild(i).position);
            }
        }
        return(result);
    }
Exemple #3
0
    public List <GameObject> GetBPList(BattleRoleType type)
    {
        List <GameObject> result = new List <GameObject>();
        string            bproot = Define.GetRootName(type);
        Transform         parent = transform.FindChild(bproot);

        if (parent != null)
        {
            for (int i = 0; i < parent.childCount; i++)
            {
                result.Add(parent.GetChild(i).gameObject);
            }
        }
        result.Sort(delegate(GameObject obj1, GameObject obj2) { return(obj1.name.CompareTo(obj2.name)); });
        return(result);
    }
Exemple #4
0
    public void AddBPObj(int index, BattleRoleType type)
    {
        string    bproot = Define.GetRootName(type);
        Transform parent = transform.FindChild(bproot);

        if (parent == null)
        {
            parent               = new GameObject(bproot).transform;
            parent.parent        = this.transform;
            parent.localPosition = Vector3.zero;
            parent.localScale    = Vector3.one;
        }
        GameObject bp = new GameObject("bp_" + index.ToString("00"));

        bp.transform.parent        = parent;
        bp.transform.localPosition = Vector3.zero;
        bp.transform.localScale    = Vector3.one;
    }
Exemple #5
0
    public static string GetRootName(BattleRoleType type)
    {
        string bproot = "";

        if (type == BattleRoleType.Self || type == BattleRoleType.Rival)
        {
            bproot = _bpRoot_self;
        }
        else if (type == BattleRoleType.Monster)
        {
            bproot = _bpRoot_monster;
        }
        else if (type == BattleRoleType.Boss)
        {
            bproot = _bpRoot_boss;
        }
        return(bproot);
    }
Exemple #6
0
    public void RemoveBpObj(GameObject bpObj, BattleRoleType type)
    {
        string    bproot = Define.GetRootName(type);
        Transform parent = transform.FindChild(bproot);

        if (parent != null)
        {
            for (int i = 0; i < parent.childCount; i++)
            {
                GameObject obj = parent.GetChild(i).gameObject;
                if (obj == bpObj)
                {
                    DestroyImmediate(obj);
                    break;
                }
            }
            //update obj name
            for (int i = 0; i < parent.childCount; i++)
            {
                GameObject obj = parent.GetChild(i).gameObject;
                obj.name = "bp_" + i.ToString("00");
            }
        }
    }