Ejemplo n.º 1
0
 public void SetData(CObj_Build setdata)
 {
     data = setdata;
 }
Ejemplo n.º 2
0
    void applydata(CObj_Build _data)
    {
        //모양
        switch (_data.BType)
        {
            case CObj.BuildType.square:
                sp_square.gameObject.SetActive(true);
                sp_circle.gameObject.SetActive(false);
                sp_tri.gameObject.SetActive(false);
                sp_Instant = sp_square;
                break;

            case CObj.BuildType.circle:
                sp_square.gameObject.SetActive(false);
                sp_circle.gameObject.SetActive(true);
                sp_tri.gameObject.SetActive(true);
                sp_Instant = sp_circle;
                break;

            case CObj.BuildType.tri:
                sp_square.gameObject.SetActive(false);
                sp_circle.gameObject.SetActive(false);
                sp_tri.gameObject.SetActive(true);
                sp_Instant = sp_tri;
                break;
        }

        //반복타입
        width = (int)(_data.RightTop.x - _data.LeftBot.x);
        height = (int)(_data.RightTop.y - _data.LeftBot.y);

        switch (_data.tType)
        {
            //case CObj.TiledType.none:
            //    wd_this.width = (int)width;
            //    wd_this.height = (int)height;
            //    //지금은 크기에 따라 위젯조절만 하지만 플레이어 기준 크기 정해지면 플레이어 크기 대비 scale 조정으로 수정. square 이외에 collider 조정 불가 이슈떄문
            //    break;

            //case CObj.TiledType.horizon:
            //    int instCount = width / (int)Common.Common.PlayerSize.x;
            //    sp_Instant.height = height;
            //    for(int i = 0; )
            //    break;

            //case CObj.TiledType.vertical:

            //    break;

            //case CObj.TiledType.tiled:

            //    break;

            default:
                wd_this.width = (int)width;
                wd_this.height = (int)height;
                break;
        }

        //위치
        gameObject.transform.localPosition = (Vector3)_data.LeftBot;

        //기울기
        transform.Rotate(new Vector3(0, 0, _data.tilt));

    }
Ejemplo n.º 3
0
    void MapLoading()
    {
        #if UNITY_EDITOR
                parser.Load(Application.dataPath + "/testmap.xml");
        #endif

                //#if 안드로이드, IOS 넣어야함
                //#endif

        XmlNode Object_b = parser.FirstChild.ChildNodes[0];
        XmlNode Object_g = parser.FirstChild.ChildNodes[1];

        List<GameObject> obj_b_pool = new List<GameObject>(GameObject.FindGameObjectsWithTag("Obj_Build"));
        List<GameObject> obj_g_pool = new List<GameObject>(GameObject.FindGameObjectsWithTag("Obj_Get"));

        if (Object_b != null)
        {
            if (obj_b_pool.Count < Object_b.ChildNodes.Count)
            {
                int instiateCount = Object_b.ChildNodes.Count - obj_b_pool.Count;
                for (int i = 0; i < instiateCount; i++)
                {
                    obj_b_pool.Add((GameObject)Instantiate(obj_b_pool[0], obj_b_pool[0].transform.position, Quaternion.identity));
                }
            }

            for (int i = 0; i < Object_b.ChildNodes.Count; i++)
            {
                CObj_Build temp = new CObj_Build();
                temp.SetData(Object_b.ChildNodes[i]);
                obj_b_list.Add(temp) ;//.SetData(Object_b.ChildNodes[i]));
            }

            for (int i = 0; i < obj_b_list.Count; i++)
            {
                obj_b_pool[i].GetComponent<IT_Obj_Build>().SetData(obj_b_list[i]);
            }
        }

        if (Object_g != null)
        {
            if (obj_g_pool.Count < obj_g_list.Count)
            {
                int instiateCount = obj_g_list.Count - obj_g_pool.Count;
                for (int i = 0; i <= instiateCount; i++)
                    obj_g_pool.Add((GameObject)Instantiate(obj_g_pool[0], obj_g_pool[0].transform.position, obj_g_pool[0].transform.rotation));
            }

            for (int i = 0; i < Object_g.ChildNodes.Count; i++)
            {
                CObj_Get temp = new CObj_Get();
                temp.SetData(Object_b.ChildNodes[i]);
                obj_g_list.Add(temp);//.SetData(Object_b.ChildNodes[i]));
            }

            if (obj_g_pool.Count < obj_g_list.Count)
            {
                int instiateCount = obj_g_list.Count - obj_g_pool.Count;
                for (int i = 0; i < instiateCount; i++)
                    obj_g_pool.Add((GameObject)Instantiate(obj_g_pool[0], obj_g_pool[0].transform.position, obj_g_pool[0].transform.rotation));
            }

            for (int i = 0; i < obj_g_list.Count; i++)
            {
                obj_g_pool[i].GetComponent<IT_Obj_Get>().SetData(obj_g_list[i]);
            }
        }
        //pool보다 list가 클 경우 예외처리 해 줘야함
    }