コード例 #1
0
ファイル: PrivateRoom.cs プロジェクト: jabbo/Jabbo
        public void setHeightmapping()
        {
            int colX = breed;
            int colY = lang;

            _sqUnit = new bool[colX, colY]; // the avatars
            _sqHeight = new byte[colX, colY];
            _sqRot = new byte[colX, colY];
            _sqTile = new string[colX, colY];
            _sqState = new squareState[colX, colY];
            _sqStack = new ItemStack[colX, colY];

            bool deurgeweest = false;
            for (int y = 0; y < colY; y++)
            {
                for (int x = 0; x < colX; x++)
                {
                    _sqStack[x, y] = new ItemStack();
                    _sqUnit[x, y] = false;
                    _sqRot[x, y] = 0;
                    _sqTile[x, y] = (x + 1) + "_" + (y + 1);
                    _sqState[x, y] = squareState.Open;

                    try { _sqHeight[x, y] = byte.Parse("0"); }
                    catch { }

                    if (!holes.Contains((x+1)+"_"+(y+1)))
                    {
                        if (x == door_x && (y - 1) == door_y && !deurgeweest)
                        {
                            doorstep_x = x;
                            doorstep_y = y;
                            door_dir = 1;
                            deurgeweest = true;
                        }
                        if ((x - 1) == door_x && y == door_y && !deurgeweest)
                        {
                            doorstep_x = x;
                            doorstep_y = y;
                            door_dir = 2;
                            deurgeweest = true;
                        }
                    }
                }
            }

            foreach (string hole in holes)
            {
                if (hole != "")
                {
                    int X = int.Parse(hole.Split('_')[0]) - 1;
                    int Y = int.Parse(hole.Split('_')[1]) - 1;

                    _sqState[X, Y] = squareState.Blocked;
                    _sqStack[X, Y] = null;
                }
            }
        }
コード例 #2
0
ファイル: PrivateRoom.cs プロジェクト: jabbo/Jabbo
        public void updateHeightmapping()
        {
            _sqHeight = new byte[breed, lang];
            _sqRot = new byte[breed, lang];
            _sqTile = new string[breed, lang];
            _sqState = new squareState[breed, lang];
            _sqStack = new ItemStack[breed, lang];

            for (int y = 0; y < lang; y++)
            {
                for (int x = 0; x < breed; x++)
                {
                    _sqStack[x, y] = new ItemStack();
                    _sqState[x, y] = squareState.Open;
                    try { _sqHeight[x, y] = byte.Parse("0"); }
                    catch { }
                    _sqRot[x, y] = 0;
                    _sqTile[x, y] = (x+1)+"_"+(y+1);
                }
            }
            foreach (string hole in holes)
            {
                if (hole != "")
                {
                    int X = int.Parse(hole.Split('_')[0]) - 1;
                    int Y = int.Parse(hole.Split('_')[1]) - 1;

                    _sqState[X, Y] = squareState.Blocked;
                    _sqStack[X, Y] = null;
                }
            }

            foreach (Item itm in furniture.Values)
            {
                CatalogueManager.ItemTemplate furniTemplate = CatalogueManager.getTemplate(itm.furni);
                if (furniTemplate.soort != "poster" && furniTemplate.soort != "tapijt")
                {
                    int X = int.Parse(itm.tile.Split('_')[0]) - 1;
                    int Y = int.Parse(itm.tile.Split('_')[1]) - 1;
                    int lengte = 0;
                    int breedte = 0;
                    bool door = false;
                    if (furniTemplate.soort == "poort" && itm.action == 1)
                    {
                        door = true;
                    }
                    switch (itm.turn)
                    {
                        case 1:
                            lengte = furniTemplate.lang;
                            breedte = furniTemplate.breed;
                            break;
                        case 2:
                            lengte = furniTemplate.breed;
                            breedte = furniTemplate.lang;
                            break;
                        case 3:
                            lengte = furniTemplate.lang;
                            breedte = furniTemplate.breed;
                            break;
                        case 4:
                            lengte = furniTemplate.breed;
                            breedte = furniTemplate.lang;
                            break;
                    }
                    for (int i1 = 0; i1 < lengte; i1++)
                    {
                        for (int i2 = 0; i2 < breedte; i2++)
                        {
                            try
                            {
                                if (door)
                                {
                                    _sqState[(X - i1), (Y + i2)] = squareState.Door;
                                }
                                else if (furniTemplate.soort == "stoel")
                                {
                                    _sqState[(X - i1), (Y + i2)] = squareState.Seat;
                                }
                                else
                                {
                                    _sqState[(X - i1), (Y + i2)] = squareState.Blocked;
                                }
                                _sqRot[(X - i1), (Y + i2)] = byte.Parse(itm.turn.ToString());
                                _sqTile[(X - i1), (Y + i2)] = itm.tile;
                            }
                            catch { }
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: virtualRoom.cs プロジェクト: habb0/HoloRebirth
 internal void setSquareState(int X, int Y, int Length, int Width, squareState State)
 {
     for (int jX = X; jX < X + Width; jX++)
     {
         for (int jY = Y; jY < Y + Length; jY++)
         {
             sqSTATE[jX, jY] = State;
         }
     }
 }