Exemplo n.º 1
0
    private void genMinMap(Dictionary <int[], int[]> map, int z)
    {
        // MinPlane.transform.localPosition = showPos;
        foreach (int[] key in map.Keys)
        {
            Vector3 temPos = initMinRoom.localPosition;
            temPos.x = key[0] * minRoomhorizonDis;
            temPos.y = key[1] * minRoomvertiDis;

            GameObject newDi = Instantiate(minRoom) as GameObject;
            MinMapRoom mmr   = newDi.GetComponent <MinMapRoom>();
            mmr.setXYZ(key);
            if (map[key][0] == 1)
            {
                mmr.setNorthDoorenable();
            }
            if (map[key][1] == 1)
            {
                mmr.setSouthDoorenable();
            }
            if (map[key][2] == 1)
            {
                mmr.setWestDoorenable();
            }
            if (map[key][3] == 1)
            {
                mmr.setEastDoorenable();
            }
            if (z == RoomConstant.ROOM_Z_UP)
            {
                MinUpPlane.SetActive(true);
                newDi.GetComponent <RectTransform>().SetParent(MinUpPlane.transform);
            }
            else if (z == RoomConstant.ROOM_Z_GROUND)
            {
                MinGroPlane.SetActive(true);
                newDi.GetComponent <RectTransform>().SetParent(MinGroPlane.transform);
            }
            else if (z == RoomConstant.ROOM_Z_DOWN)
            {
                MinDownPlane.SetActive(true);
                newDi.GetComponent <RectTransform>().SetParent(MinDownPlane.transform);
            }
            newDi.GetComponent <RectTransform>().localPosition = temPos;
            newDi.SetActive(false);
            roomManager.addMiniRoomList(key, mmr);
        }
    }
Exemplo n.º 2
0
    private void checkDoorStatus(MinMapRoom mRoom, MinMapRoom mmr)
    {
        if (mRoom.getEastDoorStatus())
        {
            mmr.setEastDoorenable();
            newDi5.GetComponent <RectTransform>().localPosition = showRPos;

            MinMapRoom eRoom = newDi5.GetComponent <MinMapRoom>();
            east[0] = mRoom.xyz[0];
            east[1] = mRoom.xyz[1];
            east[2] = mRoom.xyz[2];
            east[0] = east[0] + 1;

            MinMapRoom eNextRoom = roomContraller.findMiniRoomByXYZ(east);
            this.checkPStatus(eNextRoom, eRoom);
            if (eNextRoom.isVisited())
            {
                newDi5.SetActive(true);
            }
            else
            {
                newDi5.SetActive(false);
            }
        }
        else
        {
            mmr.setEastDoorDisable();
            newDi5.SetActive(false);
        }
        if (mRoom.getWestDoorStatus())
        {
            mmr.setWestDoorenable();


            newDi4.GetComponent <RectTransform>().localPosition = showLPos;

            MinMapRoom wRoom = newDi4.GetComponent <MinMapRoom>();
            west[0] = mRoom.xyz[0];
            west[1] = mRoom.xyz[1];
            west[2] = mRoom.xyz[2];

            west[0] = west[0] - 1;

            MinMapRoom wNextRoom = roomContraller.findMiniRoomByXYZ(west);
            this.checkPStatus(wNextRoom, wRoom);
            if (wNextRoom.isVisited())
            {
                newDi4.SetActive(true);
            }
            else
            {
                newDi4.SetActive(false);
            }
        }
        else
        {
            mmr.setWestDoorDisable();
            newDi4.SetActive(false);
        }
        if (mRoom.getSouthDoorStatus())
        {
            mmr.setSouthDoorenable();



            newDi3.GetComponent <RectTransform>().localPosition = showDPos;

            MinMapRoom sRoom = newDi3.GetComponent <MinMapRoom>();
            south[0] = mRoom.xyz[0];
            south[1] = mRoom.xyz[1];
            south[2] = mRoom.xyz[2];

            south[1] = mRoom.xyz[1] - 1;

            MinMapRoom sNextRoom = roomContraller.findMiniRoomByXYZ(south);
            this.checkPStatus(sNextRoom, sRoom);
            if (sNextRoom.isVisited())
            {
                newDi3.SetActive(true);
            }
            else
            {
                newDi3.SetActive(false);
            }
        }
        else
        {
            mmr.setSouthDoorDisable();
            newDi3.SetActive(false);
        }
        if (mRoom.getNorthDoorStatus())
        {
            mmr.setNorthDoorenable();


            newDi2.GetComponent <RectTransform>().localPosition = showUPos;

            MinMapRoom nRoom = newDi2.GetComponent <MinMapRoom>();
            north[0] = mRoom.xyz[0];
            north[1] = mRoom.xyz[1];
            north[2] = mRoom.xyz[2];


            north[1] = mRoom.xyz[1] + 1;

            MinMapRoom nNextRoom = roomContraller.findMiniRoomByXYZ(north);
            this.checkPStatus(nNextRoom, nRoom);
            if (nNextRoom.isVisited())
            {
                newDi2.SetActive(true);
            }
            else
            {
                newDi2.SetActive(false);
            }
        }
        else
        {
            mmr.setNorthDoorDisable();
            newDi2.SetActive(false);
        }
    }