コード例 #1
0
ファイル: GameEngine.cs プロジェクト: dongbin300/NGDG2
        /// <summary>
        /// 게임에 필요한 리소스를 불러온다.
        /// 리소스가 하나라도 정상적으로 불러와지지않을 경우 즉시 종료한다.
        /// </summary>
        public bool LoadResource()
        {
            try
            {
                // 몬스터 리소스 로드
                _ = new MonsterDictionary();

                // 던전 리소스 로드
                _ = new DungeonDictionary();

                // 장비 리소스 로드
                // 재료 리소스 로드
                // 포션 리소스 로드
                _ = new ItemDictionary();

                // 화면 리소스 로드
                _ = new ScreenManager();
            }
            catch
            {
                // 로드 실패
                return(false);
            }

            // 로드 성공
            return(true);
        }
コード例 #2
0
        public DungeonWave(List <Monster> monsterList, int monsterCount)
        {
            var r = new SmartRandom();

            Monsters = new List <Monster>();
            for (int i = 0; i < monsterCount; i++)
            {
                Monsters.Add(MonsterDictionary.MakeMonster(monsterList[r.Next(monsterList.Count)].Name));
            }
        }
コード例 #3
0
ファイル: Dungeon.cs プロジェクト: dongbin300/NGDG2
        /// <summary>
        /// 던전을 만든다.
        /// </summary>
        public Dungeon Make(Dungeon frame)
        {
            Name = frame.Name;
            FormattedDungeonInfo = frame.FormattedDungeonInfo;

            // 인포 파싱
            string[] infos = FormattedDungeonInfo.Split('/');

            int waveCount = int.Parse(infos[0]);

            string[] monsterNames  = infos[1].Split(',');
            string[] monsterCounts = infos[2].Split('~');

            // 몬스터 수 범위 구성
            var bound = new Bounds(int.Parse(monsterCounts[0]), int.Parse(monsterCounts[1]));

            // 몬스터 출현 목록 구성
            List <Monster> monsterList = new List <Monster>();

            foreach (string monsterName in monsterNames)
            {
                monsterList.Add(MonsterDictionary.MakeMonster(monsterName));
            }

            // 던전 웨이브 생성
            Waves = new List <DungeonWave>();
            for (int i = 0; i < waveCount; i++)
            {
                Waves.Add(new DungeonWave(monsterList, bound.Get()));
            }

            // 던전 보상 초기화
            AccumulatedExp   = 0;
            AccumulatedGold  = 0;
            AccumulatedItems = new Inventory(20); // 한 던전에서의 아이템 획득 종류 최대 20

            return(this);
        }