public void LoadScreen(Screen screen)
        {
            // Transition out of the current screens
            foreach (Screen s in screens)
            {
                s.TransitionOff();
            }

            screenToLoad = screen;
            loadingScreen = true;
        }
        public ParticleEmitter(Screen screen, int particleCount, Rectangle rectangle, Vector2 minVelocity, Vector2 maxVelocity, Vector2 acceleration, Color minColor, Color maxColor, TimeSpan duration)
        {
            Screen = screen;
            particles = new List<Particle>();

            for (int p = 0; p < particleCount; p++)
            {
                float degrees = random.Next(0, 359);
                float speed = (float)random.Next((int)maxVelocity.X);
                Vector2 velocity = new Vector2((float)Math.Cos(MathHelper.ToRadians(degrees)) * speed, (float)Math.Sin(MathHelper.ToRadians(degrees)) * speed);
                float brightness = (float)random.NextDouble();
                Color color = new Color(random.Next(minColor.R, maxColor.R), random.Next(minColor.G, maxColor.G), random.Next(minColor.B, maxColor.B), random.Next(minColor.A, maxColor.A));
                particles.Add(new Particle(this, rectangle, velocity, acceleration, color, duration));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Construct the board
        /// </summary>
        /// <param name="graphicsDevice"></param>
        public Board(Screen screen)
        {
            Screen = screen;   

            // Create the board
            Blocks = new Block[Rows, Columns];
            for (int row = 0; row < Rows; row++)
            {
                for (int column = 0; column < Columns; column++)
                {
                    Blocks[row, column] = new Block(this, Screen, row, column);

                    // Only fill the first bottom Rows
                    if (row < initialEmptyRows)
                    {
                        Blocks[row, column].Empty();
                    }
                    else
                    {
                        Blocks[row, column].Create();
                    }
                }
            }

            // Create the next row of Blocks
            NextBlocks = new Block[Columns];
            for (int column = 0; column < Columns; column++)
            {
                NextBlocks[column] = new Block(this, Screen, Rows, column);
                NextBlocks[column].Create();
                NextBlocks[column].State = Block.BlockState.Preview;
            }

            CelebrationManager = new CelebrationManager(this);

            Renderer = new BoardRenderer(this);
            controller = new BoardController(this);
            Stats = new BoardStats(this);

            RaiseRate = (double)Stats.Level / 4;

            // Initialize buttons
            retryButton = new Button(screen, "Retry", Color.White, new Rectangle(Renderer.Rectangle.X + Renderer.Rectangle.Width / 4 - 50, Renderer.Rectangle.Y + Renderer.Rectangle.Height - 150, Renderer.Rectangle.Width / 4, 100), Color.Orange);
            retryButton.Selected += retryButton_Selected;

            doneButton = new Button(screen, "Done", Color.White, new Rectangle(Renderer.Rectangle.X + Renderer.Rectangle.Width / 2 + 50, Renderer.Rectangle.Y + Renderer.Rectangle.Height - 150, Renderer.Rectangle.Width / 4, 100), Color.Orange);
            doneButton.Selected += doneButton_Selected;
        }
        public void RemoveScreen(Screen screen)
        {
            screen.UnloadContent();

            screens.Remove(screen);
        }
        public void AddScreen(Screen screen)
        {
            screen.LoadContent();

            screens.Add(screen);
        }
Esempio n. 6
0
 // Construct the block
 public Block(Board board, Screen screen, int row, int column)
 {
     Board = board;
     Renderer = new BlockRenderer(this, row, column);
     PopulatingDelay = TimeSpan.FromMilliseconds(random.Next(0, (int)PopulatingMaxDelay.TotalMilliseconds));
 }