Ejemplo n.º 1
0
    private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent)
    {
        // debug visualization
        DT1.Tile tile;
        if (specialTiles.Sample(cell.tileIndex, out tile))
        {
            var renderer = CreateTile(tile, x, y, parent: parent);
            renderer.gameObject.layer = UnityLayers.SpecialTiles;
        }

        if (info == null)
        {
            return;
        }

        if (cell.mainIndex < 8)
        {
            int targetLevelId = info.vis[cell.mainIndex];
            int warpId        = info.warp[cell.mainIndex];
            var targetLevel   = LevelInfo.Find(targetLevelId);
            var levelWarpInfo = LevelWarpInfo.Find(warpId);
            if (levelWarpInfo == null)
            {
                Debug.LogWarning("Warp info wasn't found");
                return;
            }
            Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent);
        }
    }
Ejemplo n.º 2
0
        private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent)
        {
            // debug visualization
            if (specialTiles.Sample(cell.tileIndex, out var tile))
            {
                WorldState.instance.Grid.PutSpecialTile(tile, x, y);
            }

            if (info == null)
            {
                return;
            }

            if (cell.mainIndex < 8)
            {
                int targetLevelId = info.vis[cell.mainIndex];
                int warpId        = info.warp[cell.mainIndex];
                var targetLevel   = LevelInfo.Find(targetLevelId);
                var levelWarpInfo = LevelWarpInfo.Find(warpId);
                if (levelWarpInfo == null)
                {
                    Debug.LogWarning("Warp info wasn't found");
                    return;
                }
                Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent);
            }
        }
Ejemplo n.º 3
0
        private Warp FindTargetWarp()
        {
            for (int i = 0; i < targetLevel.vis.Length; ++i)
            {
                if (targetLevel.vis[i] == sourceLevel.id)
                {
                    int  warpId = targetLevel.warp[i];
                    Warp warp   = LevelWarpInfo.Find(warpId).instance;
                    if (warp != null)
                    {
                        return(warp);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        public static void LoadAll()
        {
            var sw = System.Diagnostics.Stopwatch.StartNew();

            Translation.Load();
            SoundInfo.Load();
            SoundEnvironment.Load();
            ObjectInfo.Load();
            BodyLoc.Load();
            ExpTable.Load();
            LevelType.Load();
            LevelWarpInfo.Load();
            LevelPreset.Load();
            LevelMazeInfo.Load();
            LevelInfo.Load();
            OverlayInfo.Load();
            MissileInfo.Load();
            ItemStat.Load();
            ItemRatio.Load();
            ItemType.Load();
            ItemPropertyInfo.Load();
            ItemSet.Load();
            UniqueItem.Load();
            SetItem.Load();
            TreasureClass.Load();
            MagicAffix.Load();
            CharStatsInfo.Load();
            MonLvl.Load();
            MonPreset.Load();
            MonSound.Load();
            MonStatsExtended.Load();
            MonStat.Load();
            SuperUnique.Load();
            SkillDescription.Load();
            SkillInfo.Load();
            SpawnPreset.Load();
            StateInfo.Load();
            Debug.Log("All txt files loaded in " + sw.ElapsedMilliseconds + " ms");
        }
Ejemplo n.º 5
0
        public static Warp Create(int x, int y, LevelWarpInfo warpInfo, LevelInfo sourceLevel, LevelInfo targetLevel, Transform parent)
        {
            var offset = new Vector3(warpInfo.offsetX, warpInfo.offsetY);
            var pos    = new Vector3(x, y) * Iso.SubTileCount - new Vector3(2, 2) + offset;

            pos = Iso.MapToWorld(pos);

            var warpObject = new GameObject(targetLevel.levelWarp);

            warpObject.transform.position = pos;
            warpObject.transform.SetParent(parent);
            var warp = warpObject.AddComponent <Warp>();

            warp.sourceLevel   = sourceLevel;
            warp.targetLevel   = targetLevel;
            warp.info          = warpInfo;
            warp.transform     = warpObject.transform;
            warp.selectSize    = new Vector3(warpInfo.selectDX, warpInfo.selectDY) / Iso.pixelsPerUnit;
            warp.selectOffset  = new Vector3(warpInfo.selectX, -warpInfo.selectY) / Iso.pixelsPerUnit;
            warp.selectOffset += new Vector3(warp.selectSize.x, -warp.selectSize.y) / 2;
            warpInfo.instance  = warp;
            return(warp);
        }