コード例 #1
0
ファイル: Data.cs プロジェクト: danbystrom/Serpent
        public Data( Game game1 )
        {
            if ( Instance != null )
                Instance.Dispose();
            Instance = this;

            var texture = game1.Content.Load<Texture2D>(@"Textures\grass");

            if ( PlayingField == null )
                PlayingField = new PlayingField(
                    game1.GraphicsDevice,
                    texture );

            var serpentHead = new ModelWrapper( game1, game1.Content.Load<Model>(@"Models\SerpentHead") );
            var serpentSegment = new ModelWrapper( game1, game1.Content.Load<Model>(@"Models\serpentsegment") );

            PlayerSerpent = new PlayerSerpent(
                game1,
                PlayingField,
                serpentHead,
                serpentSegment);

            for (var i = 0; i < 5; i++)
            {
                var enemy = new EnemySerpent(
                    game1,
                    PlayingField,
                    serpentHead,
                    serpentSegment,
                    PlayerSerpent.Camera,
                    new Whereabouts(0, new Point(20, 0), Direction.West),
                    i);
                Enemies.Add(enemy);
            }
        }
コード例 #2
0
        public Data(Game game1)
        {
            if (Instance != null)
            {
                Instance.Dispose();
            }
            Instance = this;

            var texture = game1.Content.Load <Texture2D>(@"Textures\grass");

            if (PlayingField == null)
            {
                PlayingField = new PlayingField(
                    game1.GraphicsDevice,
                    texture);
            }

            var serpentHead    = new ModelWrapper(game1, game1.Content.Load <Model>(@"Models\SerpentHead"));
            var serpentSegment = new ModelWrapper(game1, game1.Content.Load <Model>(@"Models\serpentsegment"));

            PlayerSerpent = new PlayerSerpent(
                game1,
                PlayingField,
                serpentHead,
                serpentSegment);

            for (var i = 0; i < 5; i++)
            {
                var enemy = new EnemySerpent(
                    game1,
                    PlayingField,
                    serpentHead,
                    serpentSegment,
                    PlayerSerpent.Camera,
                    new Whereabouts(0, new Point(20, 0), Direction.West),
                    i);
                Enemies.Add(enemy);
            }
        }