コード例 #1
0
        // ===============================================================================
        // MAP RELATED
        // ===============================================================================

        // -------------------------------------------------------------------------------
        // LoadDungeon
        // -------------------------------------------------------------------------------
        public DungeonMap LoadDungeon(TemplateMetaDungeon mapConfig)
        {
            DungeonMap map = null;

            if (mapConfig == null)
            {
                throw new ArgumentException("No map configuration available!");
            }

            if (mapConfig.mapFile == null)
            {
                throw new ArgumentException("No map file available in map configuration: " + mapConfig);
            }

            map = new DungeonMap(mapConfig.mapFile.height, mapConfig.mapFile.width);

            for (int x = 0; x < mapConfig.mapFile.width; x++)
            {
                for (int y = 0; y < mapConfig.mapFile.height; y++)
                {
                    ScriptableTile tile = mapConfig.mapFile.map[x + y * mapConfig.mapFile.width];
                    map.SetTile(x, y, tile);
                }
            }

            if (map == null)
            {
                throw new ArgumentException("Loaded map is empty!");
            }

            return(map);
        }
コード例 #2
0
 // -------------------------------------------------------------------------------
 // getHasExploredDungeon
 // -------------------------------------------------------------------------------
 public bool getHasExploredDungeon(TemplateMetaDungeon map)
 {
     if (map == null)
     {
         return(true);
     }
     return(MapExplorationInfo.GetMapExplored(map.name));
 }
コード例 #3
0
        protected override void TemplateInitialize(GameObject templateInstance, string item)
        {
            Button button = templateInstance.GetComponent <Button>();

            if (button != null)
            {
                TemplateMetaDungeon map = DictionaryDungeon.Get(item);
                button.UpdateText(map.name);

                button.onClick.AddListener(new UnityEngine.Events.UnityAction(() =>
                {
                    Finder.map.WarpDungeon(map);
                }));
            }
        }
コード例 #4
0
        // -------------------------------------------------------------------------------
        // WarpDungeon
        // -------------------------------------------------------------------------------
        public void WarpDungeon(TemplateMetaDungeon map, bool start = true)
        {
            if (map == null)
            {
                throw new ArgumentException("WarpDungeon failed: Template is empty!");
            }

            PrepareWarp();
            Finder.ui.OverrideState(UIState.Dungeon);
            currentDungeonConfig = map;
            LoadFloor();
            SetPlayerPosition(start);
            Finder.audio.PlayBGM(map.music);
            OnFloorChanged();
            Finder.log.Hide();
            locationType = LocationType.Dungeon;
        }