Пример #1
0
    //public enum rowType { left, top, right, bottom }
    private int[,] GetGroundAroundMe()
    {
        int[,] arrayMap = new int[16, 12];
        string miniMap = "";

        for (int i = 1; i < 12; i++)
        {
            miniMap += "[";
            for (int j = 1; j < 16; j++)
            {
                {
                    OpenTibiaUnity.Core.WorldMap.Field _field = GameManager.Instance.WorldMapStorage.GetField(new Vector3Int(j, i, 0));
                    int countItem = _field.ObjectsNetwork.Where(c => c != null).Count();

                    int groundId = 0;
                    if (_field.ObjectsNetwork[0] != null)
                    {
                        groundId = (int)_field.ObjectsNetwork[0].Id;
                    }

                    arrayMap[j - 1, i - 1] = groundId;

                    miniMap += countItem + ",";
                }
            }
            miniMap += "]" + "\n";
        }
        return(arrayMap);
    }
Пример #2
0
    private ObjItem[,,] AllDataAroundMe()
    {
        int[,] arrayMap = new int[16, 12];

        ObjItem[,,] arrayObjItem = new ObjItem[16, 12, 8];

        string miniMap = "";

        for (int stage = 0; stage < 8; stage++)
        {
            miniMap += "stage: " + stage + "\n";

            for (int i = 1; i < 12; i++)
            {
                miniMap += "[";
                for (int j = 1; j < 16; j++)
                {
                    {
                        OpenTibiaUnity.Core.WorldMap.Field _field = GameManager.Instance.WorldMapStorage.GetField(new Vector3Int(j, i, stage));
                        int countItem = _field.ObjectsNetwork.Where(c => c != null).Count();

                        int groundId = 0;
                        if (_field.ObjectsNetwork[0] != null)
                        {
                            groundId = (int)_field.ObjectsNetwork[0].Id;
                        }

                        ObjItem _objItem = new ObjItem();

                        bool done = false;
                        for (int e = 0; e < _field.ObjectsNetwork.Length; e++)
                        {
                            if (_field.ObjectsNetwork[e] != null)
                            {
                                if (!done)
                                {
                                    _objItem._shouldRecalculateTRS = _field.ObjectsNetwork[0]._shouldRecalculateTRS;
                                    done = true;

                                    if (stage == 1)
                                    {
                                        _objItem._shouldRecalculateTRS = _field.ObjectsNetwork[0]._shouldRecalculateTRS;
                                    }
                                }
                                _objItem.items.Add((int)_field.ObjectsNetwork[e].Id);
                            }
                        }
                        arrayObjItem[j - 1, i - 1, stage] = _objItem;
                        arrayMap[j - 1, i - 1]            = groundId;

                        int value = done == false ? 0 : 1;
                        miniMap += value + ",";
                    }
                }
                miniMap += "]" + "\n";
            }
        }
        print(miniMap);
        return(arrayObjItem);
    }
Пример #3
0
    public void DrawMap()
    {
        var xLength = tileHolders.Length;

        for (int x = 0; x < xLength; x++)
        {
            var yLength = tileHolders[x].Length;
            for (int y = 0; y < yLength; y++)
            {
                var levels = tileHolders[x][y].Length;
                for (int level = 0; level < levels; level++)
                {
                    OpenTibiaUnity.Core.WorldMap.Field _field = GameManager.Instance.WorldMapStorage.GetField(new Vector3Int(x, y, level));

                    for (int i = 0; i < _field.ObjectsNetwork.Length; i++)
                    {
                        if (_field.ObjectsNetwork[i] != null)
                        {
                            var item = _field.ObjectsNetwork[i];
                            tileHolders[x][y][level].Items[i].Id = item.Id;
                        }
                        else
                        {
                            tileHolders[x][y][level].Items[i].Id = 0;
                        }

                        tileHolders[x][y][level].RefreshTile();
                    }
                }
            }
        }
    }