예제 #1
0
        /// <summary>
        /// Adds an SquidSceneComponent to the Scenecomponents collection
        /// </summary>
        /// <param name="component">The SquidSceneComponent to add</param>
        public void AddComponent(SquidSceneComponent component)
        {
            //conkerjo. i think we should check if it's already owned by a scene and throw an exception here

            component.SetOwner(this);
            SceneComponents.Add(component);
        }
예제 #2
0
        public GamePlayScene(Game game, GameOverScene scene) : base(game)
        {
            this.game            = game;
            this.maxBricks       = bricks.GetLength(0) * bricks.GetLength(1);
            this.spriteBatch     = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            this.myFont          = (SpriteFont)game.Services.GetService(typeof(SpriteFont));
            this.myFont          = game.Content.Load <SpriteFont>("Master");
            this.heartlife       = game.Content.Load <Texture2D>("heart_life");
            this.barSprite       = new BarSprite(game);
            this.ballSprite      = new BallSprite(game, this);
            this.explosionSprite = new ExplosionSprite(game, new Vector2(10, 10), false);
            this.scene           = scene;

            SceneComponents.Add(barSprite);
            SceneComponents.Add(ballSprite);
            SceneComponents.Add(explosionSprite);

            int x = 0, y = 40;

            for (int i = 0; i < bricks.GetLength(0); i++)
            {
                for (int j = 0; j < bricks.GetLength(1); j++)
                {
                    int randomNumber = random.Next(0, 4);
                    bricks[i, j] = new BrickSprite(this.game, this.ballSprite, this.explosionSprite, new Vector2(x, y), this, brickNames[randomNumber]);
                    x           += 80;
                    SceneComponents.Add(bricks[i, j]);
                }
                x  = 0;
                y += 27;
            }
        }
예제 #3
0
        public Level(Game game, Score score, Scene gameOverScene, Level nextLevel)
            : base(game)
        {
            this.game   = game;
            spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            soundCenter = (SoundCenter)game.Services.GetService(typeof(SoundCenter));
            font        = (SpriteFont)game.Services.GetService(typeof(SpriteFont));

            bg                 = new Background(game);
            paddle             = new Paddle(game);
            ball               = new Ball(game);
            this.score         = score;
            this.gameOverScene = gameOverScene;
            this.nextLevel     = nextLevel;

            SceneComponents.Add(bg);
            SceneComponents.Add(paddle);
            SceneComponents.Add(ball);
            SceneComponents.Add(this.score);

            // pause paddle and ball until start
            paddle.Enabled = false;
            ball.Enabled   = false;

            bricks = new List <Brick>();

            CreateBricks();
        }
예제 #4
0
        public Scene1(Microsoft.Xna.Framework.Game game, GraphicsDevice device) : base(game)
        {
            _game  = game;
            Device = device;

            _textureCenter = (TextureCenter)game.Services.GetService(typeof(TextureCenter));
            SpriteBatch    = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            SoundCenter    = (SoundCenter)game.Services.GetService(typeof(SoundCenter));
            Font           = (SpriteFont)game.Services.GetService(typeof(SpriteFont));
            _rocket        = new Rocket(game);
            _explosion     = new Explosion(game);
            _birds         = new Bird[3];
            SceneComponents.Add(_explosion);
            SceneComponents.Add(_rocket);
            for (var index = 0; index < _birds.Length; index++)
            {
                _birds[index] = new Bird(game, index);
                SceneComponents.Add(_birds[index]);
            }
            GenerateTerrainContour();
            SetUpPlayers();
            _rocket.Color = _carriages[0].Color;
            foreach (var carriage in _carriages)
            {
                SceneComponents.Add(carriage);
            }
            FlattenTerrainBelowPlayers();
            CreateForeground();
            Debug.WriteLine("Scene1 constarcot end!");
        }
예제 #5
0
        public GameOverScene(Game game, Score score)
            : base(game)
        {
            this.game   = game;
            spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            soundCenter = (SoundCenter)game.Services.GetService(typeof(SoundCenter));
            font        = (SpriteFont)game.Services.GetService(typeof(SpriteFont));

            this.score = score;

            SceneComponents.Add(this.score);
        }
예제 #6
0
        public InstructionsScene(Game game, OpeningScene scene)
            : base(game)
        {
            this.game        = game;
            this.scene       = scene;
            this.spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
            this.myFont      = game.Content.Load <SpriteFont>("Master");
            this.heart       = new HeartSprite(game);

            this.instructions    = new String[NUM_INSTRUCTIONS];
            this.instructions[0] = "Game Rules:";
            this.instructions[1] = "  1) Move bar with arrows so that the ball wont cross the bar.";
            this.instructions[2] = "  2) Try to hit the bricks with the ball.";
            this.instructions[3] = "Press ESC to go back to the menu";

            SceneComponents.Add(heart);
        }
예제 #7
0
 public Scene1(Game game) : base(game)
 {
     this.game          = game;
     spriteBatch        = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));
     breakerSprite      = new Breaker(game);
     ballSprite         = new ball(game);
     ballSprite.breaker = breakerSprite;
     SceneComponents.Add(ballSprite);
     SceneComponents.Add(breakerSprite);
     EndScene     = false;
     Break1Sprite = game.Content.Load <Texture2D>("break1");
     Break2Sprite = game.Content.Load <Texture2D>("break2");
     Break3Sprite = game.Content.Load <Texture2D>("break3");
     matrixX      = 2;
     matrixY      = 2;
     breaksPos    = new Break[matrixX, matrixY];
 }
예제 #8
0
        private void UpdateEntityInformation_EditorThread(CInspectorSceneComponentViewModel sceneComponentRoot, List <CInspectorEntityComponentViewModel> entityComponents, CInspectorEntityViewModel entity)
        {
            SceneComponents.Clear();
            EntityComponents.Clear();
            EntityInfo.Clear();

            if (sceneComponentRoot != null)
            {
                SceneComponents.Add(sceneComponentRoot);
            }

            if (entityComponents != null)
            {
                EntityComponents = new ObservableCollection <CInspectorEntityComponentViewModel>(entityComponents);
            }

            if (entity != null)
            {
                EntityInfo.Add(entity);
            }
        }
예제 #9
0
        public override void CreateBricks()
        {
            for (int y = 1; y < 5; y++)
            {
                for (int x = 1; x < 19; x++)
                {
                    Brick brick = null;
                    if (y == 2 && x > 1 && x < 18)
                    {
                        brick = new Coin(game);
                    }
                    else
                    {
                        brick = new Brick(game);
                    }

                    brick.Position = new Vector2(x * brickSize, y * brickSize);
                    bricks.Add(brick);
                    SceneComponents.Add(brick);
                }
            }
        }
예제 #10
0
        public override void CreateBricks()
        {
            bricks = new List <Brick>();

            for (int y = 1; y < 5; y++)
            {
                for (int x = 1; x < 19; x++)
                {
                    Brick brick = null;
                    if ((y + x) % 2 == 0)
                    {
                        brick = new RedBrick(game);
                    }
                    else
                    {
                        brick = new Brick(game);
                    }
                    brick.Position = new Vector2(x * brickSize, y * brickSize);
                    bricks.Add(brick);
                    SceneComponents.Add(brick);
                }
            }
        }