Esempio n. 1
0
        protected BoardElement(GameplayScreen game, Model model, float boardY, float boardX)
            : base(game.ScreenManager.Game)
        {
            this.IsPossiblePlace = false;
            this.model = model;
            this.boardX = boardX;
            this.boardY = boardY;
            this.game = game;
            this.world = Matrix.Identity;
            this.selectedColor = Color.Yellow;
            this.mouseOverColor = Color.Magenta;
            this.animatedStarted = false;
            this.animatedEnded = true;

            BasicEffect basicEffect = (BasicEffect)model.Meshes[0].Effects[0];

            defaultColor = Color.White.ToVector3();

            try
            {
                defaultColor = basicEffect.DiffuseColor;
            }
            catch (AccessViolationException ave)
            {

            }

            CreateBoundingBox();
        }
Esempio n. 2
0
        public Star(GameplayScreen game, Model model, Matrix view, Matrix projection, Random random)
            : base(game.ScreenManager.Game)
        {
            this.random = random;
            this.x = random.Next(-340, 200) / 100f;
            this.speed = random.Next(2, 8) / 1000f;

            float scale = random.Next(100, 1000)/100000f;

            if(speed > 0.0004)
                this.y = random.Next(5, 10);
            else
                this.y = random.Next(2, 5);

            xRotation = (float) random.Next(-360, 360);
            yRotation = (float)random.Next(-360, 360);
            zRotation = (float)random.Next(-360, 360);

            color = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());

            this.DrawOrder = 900;
            this.view = view;
            this.projection = projection;
            this.model = model;
            this.game = game;
            this.world = Matrix.Identity * Matrix.CreateScale(scale) * Matrix.CreateTranslation(x, y, 13f);
            transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
        }
Esempio n. 3
0
 public Piece(GameplayScreen game, Model model, float boardY, float boardX)
     : base(game, model, boardY, boardX)
 {
     HeadUp = false;
     PreviousHead = false;
     world = Matrix.CreateTranslation(BoardX, BoardY, 0);
     CreateBoundingBox();
 }
Esempio n. 4
0
 public Player(GameplayScreen g, PlayerIndex n, Color c, Vector2 d)
 {
     gScreen = g;
     PI = n;
     myColor = c;
     darkColor = Color.Lerp(myColor, Color.Black, 0.3f);
     display = d;
     progressBar = new UI.ProgressBar(g.ScreenManager.Game, new Rectangle((int)d.X, (int)d.Y, 300, 16));
     progressBar.maximum = MAX_POWER;
     progressBar.fillColor = Color.White;
     progressBar.borderColorInner = GameplayScreen.OCEAN;
     progressBar.backgroundColor = GameplayScreen.OCEAN;
     progressBar.target = POW_COST[(int)curPower];
 }
Esempio n. 5
0
        public BoardManager(GameplayScreen game)
            : base(game.ScreenManager.Game)
        {
            this.uiConnector = UIConnector.Instance;
            this.game = game;
            this.DrawOrder = 1000000;
            game.ScreenManager.Game.Components.Add(new Letters(game, this));

            world = Matrix.CreateScale(0.4f) * Matrix.Identity * Matrix.CreateTranslation(0f, 1.5f, 11f);
            worldRed = Matrix.CreateScale(0.3f) * Matrix.Identity * Matrix.CreateTranslation(0f, 2.5f, 13f);
            worldBlue = Matrix.CreateScale(0.5f) * Matrix.Identity * Matrix.CreateTranslation(1f, 2.5f, 9f);
            worldWhite = Matrix.CreateScale(0.2f)*Matrix.Identity*Matrix.CreateTranslation(1f, 1.7f, 13f);
            view = Matrix.CreateLookAt(new Vector3(1, 3, 17), new Vector3(0, 0, 0), Vector3.Up);
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 1.3f, 0.1f, 10000.0f);
        }
Esempio n. 6
0
 public Tile(GameplayScreen game, Model model, int boardY, int boardX)
     : base(game, model, boardY, boardX)
 {
     world = Matrix.CreateTranslation(BoardX, BoardY, 0);
     CreateBoundingBox();
 }
Esempio n. 7
0
 public AI(GameplayScreen g, PlayerIndex n, Color c, Vector2 d)
     : base(g,n,c,d)
 {
 }
Esempio n. 8
0
 public Letters(GameplayScreen game, BoardManager manager)
     : base(game.ScreenManager.Game)
 {
     this.game = game;
     this.manager = manager;
 }
Esempio n. 9
0
        /// <summary>
        /// Allows each screen to run logic.
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            // Read the keyboard and gamepad.
            input.Update();

            // Make a copy of the master screen list, to avoid confusion if
            // the process of updating one screen adds or removes others.
            screensToUpdate.Clear();

            foreach (GameScreen screen in screens)
                screensToUpdate.Add(screen);

            bool otherScreenHasFocus = !Game.IsActive;
            bool coveredByOtherScreen = false;

            // Loop as long as there are screens waiting to be updated.
            while (screensToUpdate.Count > 0)
            {
                // Pop the topmost screen off the waiting list.
                GameScreen screen = screensToUpdate[screensToUpdate.Count - 1];

                screensToUpdate.RemoveAt(screensToUpdate.Count - 1);

                // Update the screen.
                screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

                if (screen.ScreenState == ScreenState.TransitionOn ||
                    screen.ScreenState == ScreenState.Active)
                {
                    // If this is the first active screen we came across,
                    // give it a chance to handle input.
                    if (!otherScreenHasFocus)
                    {
                        screen.HandleInput(input, gameTime);

                        otherScreenHasFocus = true;
                    }

                    // If this is an active non-popup, inform any subsequent
                    // screens that they are covered by it.
                    if (!screen.IsPopup)
                        coveredByOtherScreen = true;
                }
            }

            // cast from framework Game class to ours
            GameStateManagementGame myGame = (GameStateManagementGame) Game;

            // Toggle fixed time step
            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.F))
            {
                //myGame.IsFixedTimeStep = !myGame.IsFixedTimeStep;
                //myGame.m_kInfoBox.ResetFPSCount();
            }

            // Increase or decrease our target ms per frame, which inversely effects the framerate
            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.OemMinus))
            {
                myGame.fTargetMsPerFrame += 3.0f;
                myGame.m_kInfoBox.ResetFPSCount();
            }
            else if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.OemPlus))
            {
                myGame.fTargetMsPerFrame -= 3.0f;
                myGame.m_kInfoBox.ResetFPSCount();
            }

            // Print debug trace?
            if (traceEnabled)
                TraceScreens();

            if (loadingLevel)
            {
                currentLevelScreen.Dispose();
                currentLevelScreen.ExitScreen();
                RemoveScreen(currentLevelScreen);
                loadNextLevelScreen();
                currentLevelScreen = null;

            }
        }
Esempio n. 10
0
 public void loadNextLevel(GameScreen screen, int level, int score)
 {
     loadingLevel = true;
     currentLevelScreen = (GameplayScreen)screen;
     currentLevel = level;
     currentScore = score;
 }