コード例 #1
0
ファイル: RoomManager.cs プロジェクト: xDaizu/gamejam2015
    public void SingleLinkSetup(RoomLink roomLink, GameObject[] roomList)
    {
        int        src     = roomLink.roomSrc;
        Vector3    src_pos = new Vector3(roomLink.roomSrcExit.x, roomLink.roomSrcExit.y, 0f);
        Quaternion src_rot = RoomLink.GetFacingRotation(roomLink.roomSrcFacing);
        int        dst     = roomLink.roomDst;
        Vector3    dst_pos = new Vector3(roomLink.roomDstExit.x, roomLink.roomDstExit.y, 0f);
        Quaternion dst_rot = RoomLink.GetFacingRotation(roomLink.roomDstFacing);

        GameObject door = outerWallDoorTiles[Random.Range(0, outerWallDoorTiles.Length)];

        GameObject src_door = Instantiate(door, src_pos, src_rot) as GameObject;

        src_door.transform.SetParent(Rooms[src].transform, false);

        GameObject dst_door = Instantiate(door, dst_pos, dst_rot) as GameObject;

        dst_door.transform.SetParent(Rooms[dst].transform, false);

        setDoorLink(src_door, dst_door);
        setDoorLink(dst_door, src_door);
    }