コード例 #1
0
ファイル: DungeonGame.cs プロジェクト: jaenudin86/dwarrowdelf
        public DungeonGame(string gameDir, GameOptions options)
            : base(gameDir, options)
        {
            EnvironmentObject env;

            switch (options.Map)
            {
            case GameMap.Fortress:
                env = FortressWorldCreator.InitializeWorld(this.World, options.MapSize);
                break;

            case GameMap.Adventure:
                var dwc = new DungeonWorldCreator(this.World);
                dwc.InitializeWorld(this.World, options.MapSize);
                env = dwc.MainEnv;
                break;

            default:
                throw new Exception();
            }

            var player = CreatePlayer(env);

            this.AddPlayer(player);
        }
コード例 #2
0
        public FortressGame(string gameDir, GameOptions options)
            : base(gameDir, options)
        {
            EnvironmentObject env;

            switch (options.Map)
            {
            case GameMap.Fortress:
                env = FortressWorldCreator.InitializeWorld(this.World, options.MapSize);
                break;

            case GameMap.Ball:
            case GameMap.Cube:
            {
                var creator = new ArtificialWorldCreator(this.World, options.Map);
                creator.InitializeWorld(options.MapSize);
                env = creator.MainEnv;
            }
            break;

            case GameMap.NoiseTerrain:
            {
                var creator = new NoiseWorldCreator(this.World, options.Map);
                creator.InitializeWorld(options.MapSize);
                env = creator.MainEnv;
            }
            break;

            default:
                throw new NotImplementedException();
            }

            int numPlayers = 1;

            for (int playerNum = 0; playerNum < numPlayers; ++playerNum)
            {
                var player = CreatePlayer(playerNum, env);

                this.AddPlayer(player);
            }
        }