Ejemplo n.º 1
0
 /// <summary>
 /// Allows the game component to update itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Update(GameTime gameTime)
 {
     // TODO: Add your update code here
     if (shooter.GetGameStatus() == Project_Origin.Shooter.GameStatus.Simulation)
     {
         CheckMouseClick();
     }
     base.Update(gameTime);
 }
Ejemplo n.º 2
0
        public override void Draw(GameTime gameTime)
        {
            if (shooter.GetGameStatus() == Project_Origin.Shooter.GameStatus.MainMenu)
            {
                //soundEffect.Play();
                spriteBatch.Begin();


                //Draw background
                spriteBatch.Draw(backgroundPicTexture, backgroundPicPos, null, Color.White,
                                 0.0f, backgroundPicCenter, 1.0f, SpriteEffects.None, 0.0f);

                //Draw background player image
                spriteBatch.Draw(backgroundPlayerPicTexture, backgroundPlayerPicPos, null, Color.White,
                                 0.0f, backgroundPlayerPicCenter, 0.7f, SpriteEffects.None, 0.0f);

                //Draw main menu
                spriteBatch.Draw(menuTexture, menuPos, null, Color.White,
                                 0.0f, menuCenter, 0.7f, SpriteEffects.None, 0.0f);

                //Draw title
                spriteBatch.Draw(titleTexture, titlePos, null, Color.White,
                                 0.0f, menuCenter, 1.0f, SpriteEffects.None, 0.0f);

                spriteBatch.End();
            }
            else
            {
                MediaPlayer.Stop();
            }
        }
Ejemplo n.º 3
0
        public override void Draw(GameTime gameTime)
        {
            if (shooter.GetGameStatus() == Project_Origin.Shooter.GameStatus.Start ||
                shooter.GetGameStatus() == Project_Origin.Shooter.GameStatus.Simulation)
            {
                /*
                 * RasterizerState prevRs = this.device.RasterizerState;
                 * RasterizerState rs = new RasterizerState();
                 * rs.CullMode = CullMode.None;
                 * rs.FillMode = FillMode.WireFrame;
                 * this.device.RasterizerState = rs;
                 */

                // center the map to (0,0,0) point

                Vector3 mapPos = new Vector3(-this.internalMap.MapPixelWidth / 2,
                                             -this.internalMap.MapPixelHeight / 2,
                                             0.0f);
                this.defaultEfft.VertexColorEnabled = true;
                this.defaultEfft.World      = Matrix.CreateTranslation(mapPos);
                this.defaultEfft.View       = this.camera.ViewMatrix;
                this.defaultEfft.Projection = this.camera.ProjectMatrix;

                foreach (EffectPass pass in defaultEfft.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    foreach (VertexPositionColor[] row in this.pointMatrics)
                    {
                        this.device.DrawUserPrimitives(PrimitiveType.TriangleStrip,
                                                       row, 0, row.Length - 2,
                                                       VertexPositionColor.VertexDeclaration);
                    }
                }

                if (this.internalMap != null)
                {
                    this.DrawMapWalls(gameTime);
                }

                //this.device.RasterizerState = prevRs;
            }

            base.Draw(gameTime);
        }
Ejemplo n.º 4
0
        public override void Draw(GameTime gameTime)
        {
            if (shooter.GetGameStatus() == Project_Origin.Shooter.GameStatus.Start ||
                shooter.GetGameStatus() == Shooter.GameStatus.Simulation)
            {
                /*float timeElapse = (float)gameTime.ElapsedGameTime.Milliseconds;
                 * if (playerAlphaTimer > 1000) //1s
                 * {
                 *  playerAlphaTimer = 1000;
                 *  playerAlphaSpeed *= -1;
                 * }
                 * if (playerAlphaTimer < 0) //1s
                 * {
                 *  playerAlphaTimer = 0;
                 *  playerAlphaSpeed *= -1;
                 * }
                 * playerAlphaTimer += timeElapse * playerAlphaSpeed;
                 * playerAlpha = 0.6f + (float)playerAlphaTimer / 1000.0f;*/


                DrawPlayer(gameTime);

                //If enemy is in player sight or player is shot by enemy, show enemy to let player know
                if (enemyInSight || playerInEnemySight)
                {
                    DrawOpponentPlayer(gameTime);
                }

                if (playerMode == PlayerMode.PlayerWin)
                {
                    DrawWinSymbol(gameTime);
                }
                else if (playerMode == PlayerMode.EnemyWin)
                {
                    DrawLoseSymbol(gameTime);
                }

                base.Draw(gameTime);
            }
        }