Esempio n. 1
4
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit();

            base.Update(gameTime);
        }
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(GameTime gameTime)
 {
     GraphicsDevice.Clear(Color.Black);
     spriteBatch.Begin();
     base.Draw(gameTime);
     spriteBatch.End();
 }
 public void Update(GameTime gameTime)
 {
     if (powerup == null)
     {
         if (remaining < 0)
         {
             remaining = rand.NextDouble() * 10 + 10;
             lock (phyWorld)
                 powerup = (Powerup)Activator.CreateInstance(
                     types[rand.Next(0, types.Length)], phyWorld, gameplay, rand);
             powerup.LoadContent(content);
         }
         else
             remaining -= gameTime.ElapsedGameTime.TotalSeconds;
     }
     else
     {
         if (powerup.IsActive)
             powerup.Update();
         else
         {
             phyWorld.RemoveBody(powerup);
             powerup = null;
         }
     }
 }
Esempio n. 4
2
        public override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Down) && mPrevState.IsKeyUp(Keys.Down))
            {
                if(mSelectedIndex < mUIElements.Count - 1)
                {
                    mSelectedIndex++;
                }
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Up) && mPrevState.IsKeyUp(Keys.Up))
            {
                if(mSelectedIndex > 0)
                {
                    mSelectedIndex--;
                }
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && mPrevState.IsKeyUp(Keys.Enter))
            {
                //do whatever is selected
                if(mUIElements[mSelectedIndex].Text == "Quit")
                {
                    ExitGameChanged(this, EventArgs.Empty);
                }
                if(mUIElements[mSelectedIndex].Text == "Settings")
                {

                }
            }
            mPrevState = Keyboard.GetState();
            base.Update(gameTime);
        }
 public override void Draw(GameTime aGameTime)
 {
     for (int loop = 0; loop < List.Count; loop++)
     {
         List[loop].Draw();
     }
 }
        // Most content in this class will be here, drawn.
        public override void Draw(GameTime gameTime)
        {
            switch (parent.currentState)
            {
                // Splash Screen Text
                case Game1.GameState.Start:
                    // Main Screen Text
                    parent.spriteBatch.Begin();
                    parent.spriteBatch.Draw(logo, new Vector2(parent.Window.ClientBounds.Width / 2 - 400, -40), new Rectangle(0,0,800,300), Color.White);
                    parent.spriteBatch.End();

                    break;
                // INSTRUCTION TEXT
                case Game1.GameState.Instructions:
                    parent.spriteBatch.Begin();
                    parent.spriteBatch.Draw(logo, new Vector2(parent.Window.ClientBounds.Width / 2 - 400, -40), new Rectangle(0, 0, 800, 300), Color.White);
                    parent.spriteBatch.DrawString(parent.descriptionFont, "You've decided to adopt a hippo!\n" +
                        "Keep your pet hippo happy by playing minigames and earning points!\n" +
                        "The more points you earn, the more things you can buy!\n",
                        new Vector2(20, 200), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                    parent.spriteBatch.End();
                    break;
            }

            base.Draw(gameTime);
        }
        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform);

            // Draw the menu title.
            if (titleTexture == null)
                spriteBatch.DrawString(ScreenManager.GameContent.gameFont, titleString,
                    titlePosition, Color.White * TransitionAlpha, 0, Vector2.Zero,
                    titleSize / ScreenManager.GameContent.gameFontSize,
                    SpriteEffects.None, 0);
            else
                spriteBatch.Draw(titleTexture, titlePosition, Color.White * TransitionAlpha);

            // Draw each menu entry in turn.
            for (int i = 0; i < menuEntries.Count; i++)
            {
                MenuEntry menuEntry = menuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(isSelected, gameTime);
            }

            spriteBatch.End();
        }
 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (sprite != null && visible)
     {
         spriteBatch.Draw(sprite, position, null, Color.White, 0, Vector2.Zero, new Vector2(1, spriteScale), SpriteEffects.None, 0);
     }
 }
Esempio n. 9
2
        public override ModuleName Update(GameTime gameTime)
        {
            if (PROP.allInput.Back())
                return ModuleName.Exit;
            else if (PROP.allInput.SelectMenuItem())
            {
                switch (selected)
                {
                    case 0: //New game
                        PROP.InitPlayers();   //create a ship for each player
                        refEngine.LoadLevel(LevelNumber.One);
                        return ModuleName.Engine;
                    case 1: //Options
                        return ModuleName.Options;
                    case 2: //Instructions
                        return ModuleName.Instructions;
                    case 3: //Credits
                        return ModuleName.Credits;
                    case 4: //Exit
                        return ModuleName.Exit;
                    default: //New game
                        return ModuleName.MainMenu;
                }
            }
            else if (PROP.allInput.MenuNext())
                SelectNext();
            else if (PROP.allInput.MenuPrevious())
                SelectPrevious();

            return base.Update(gameTime);
        }
Esempio n. 10
2
 public override void Update(GameTime gameTime)
 {
     Position += Speed;
     Angle += AngularSpeed;
     Opacity -= OpacityChange;
     CurrentLife += gameTime.ElapsedGameTime.Milliseconds;
 }
        public override void Draw(GameTime gameTime)
        {
            RasterizerState rs = new RasterizerState();
            rs.CullMode = CullMode.None;
            rs.FillMode = FillMode.WireFrame;
            this.device.RasterizerState = rs;

            Viewport viewport = this.device.Viewport;
            this.defaultEfft.World = Matrix.CreateTranslation(new Vector3(-this.witdth/2, -this.heigh/2, -100.0f));
            this.defaultEfft.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                              viewport.AspectRatio,
                                                                              5.0f,
                                                                              200.0f);

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

            }
            base.Draw(gameTime);
        }
Esempio n. 12
2
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            int drawCalls = 0;
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Debug.Start("drawing");
            Map.Draw(GraphicsDevice);
            player.Draw();
            Debug.Stop("drawing");

            spriteBatch.Begin();
            spriteBatch.Draw(crosshair,
                new Vector2(GraphicsDevice.Viewport.Width / 2 - crosshair.Width / 2 + 5, GraphicsDevice.Viewport.Height / 2 - crosshair.Height / 2 + 5),
                Color.White);
            spriteBatch.End();

            this.Window.Title = "FPS: " + fpsCounter.Update(gameTime);
            Debug.AddString(String.Format("FPS: {0}", fpsCounter.Update(gameTime)));
            Debug.AddString(String.Format("Draw calls: {0}", drawCalls));
            Debug.AddStringTimer("Drawing time", "drawing");
            Debug.AddString(String.Format("Player pos: {0}", player.Position));

            base.Draw(gameTime);
            /*
            * Potrzebne poniewa¿ mieszamy 3D z 2D
            */
            GraphicsDevice.BlendState = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
        }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (left.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
            if (right.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
        }
Esempio n. 14
1
        /// <summary>
        ///     Update timers.
        /// </summary>
        /// <param name="gameTime">Game time.</param>
        public void Update(GameTime gameTime)
        {
            var timersToRemove = new List<Timer>();

            for (var i = 0; i < timers.Count; i++)
            {
                var timer = timers[i];

                if (!timer.Running)
                    continue;

                timer.TimeElapsed += gameTime.ElapsedGameTime.TotalSeconds;

                if (timer.TimeElapsed >= timer.Duration)
                {
                    timer.Running = false;

                    timer.CallbackAction?.Invoke();

                    if (timer.RemoveAfterCallback)
                        timersToRemove.Add(timer);
                }
            }

            foreach (var timer in timersToRemove)
            {
                timers.Remove(timer);
            }
        }
Esempio n. 15
1
        protected override void Update(GameTime gameTime)
        {
            float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            map.Update(time);

            base.Update(gameTime);
        }
        public void DrawFlagScore(SpriteBatch spriteBatch, GameTime gameTime, float stoppingHeight)
        {
            scoreOrigin = ScoreFont.MeasureString(scoreText) / GameValues.ScoreSpriteScoreOriginOffset;

            spriteBatch.DrawString(ScoreFont, scoreText, new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreYOffset), Color.White, 0, scoreOrigin, 0.4f, SpriteEffects.None, 0f);

            if (Position.Y > stoppingHeight)
            {
                Position = new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreDropOffet);
            }
            else if (Position.Y <= stoppingHeight)
            {
                //Position.Y = stoppingHeight;
                Position = new Vector2(Position.X, stoppingHeight);
                if (scoreBuffer <= 0)
                {
                    scoreBuffer = GameValues.ScoreSpriteScoreBuffer;
                    ScoringOn = !ScoringOn;
                }
                else
                {
                    scoreBuffer--;
                }
            }
        }
Esempio n. 17
1
 /// <summary>
 /// Responds to user input, accepting or cancelling the message box.
 /// </summary>
 public override void HandleInput( InputHelper input, GameTime gameTime )
 {
     if ( input.IsMenuSelect () || input.IsMenuCancel () ||
          input.IsNewMouseButtonPress ( MouseButtons.LeftButton ) ) {
         ExitScreen ();
     }
 }
Esempio n. 18
1
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont font = ScreenManager.TopScoresFont;

            ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
            Vector2 messageSize = font.MeasureString(message);
            Vector2 messagePosition = (viewportSize - messageSize) / 2;

            const int hPad = 32;
            const int vPad = 16;
            Rectangle backgroundRectangle = new Rectangle((int)messagePosition.X - hPad,
                                                          (int)messagePosition.Y - vPad,
                                                          (int)messageSize.X + hPad * 2,
                                                          (int)messageSize.Y + vPad * 2);

            Color color = Color.White * TransitionAlpha;

            spriteBatch.Begin();
            spriteBatch.Draw(questionFrameTex, backgroundRectangle, color);
            spriteBatch.DrawString(font, message, messagePosition, color);
            spriteBatch.End();
        }
Esempio n. 19
1
        /// <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
            this.time += gameTime.ElapsedGameTime.Milliseconds;
            if (this.time >= 1000)
            {
                this.time = 0;
                this.s += 1;
                //if (s >= 60)
                //{
                //    s = 0;
                //    m += 1;
                //    if (m >= 60)
                //        h += 1;
                //}
                //if (h > 0)
                //    Console.WriteLine("時間計時:" + h + "小時" + m + "分" + s + "秒");
                //else if (m > 0)
                //    Console.WriteLine("時間計時:" + m + "分" + s + "秒");
                //else
                    Console.WriteLine("時間計時:" + s + "秒");
                    if (s > time_Max)
                        s = time_Max;
            }

            base.Update(gameTime);
        }
Esempio n. 20
1
 protected override void Draw(GameTime gameTime)
 {
     resolver.RunAllRunners();
     if (runCodeForTests != null)
         runCodeForTests();
     resolver.RunAllPresenters();
 }
Esempio n. 21
1
        protected override void Draw(GameTime gameTime)
        {
            // Clear the backbuffer
            graphics.GraphicsDevice.Clear( Color.Black );

            spriteBatch.Begin();

            // draw the sprites
            spriteBatch.Draw( background, new Rectangle(0,0,2400,1440), Color.White );
            spriteBatch.Draw( earth, new Vector2 (400, 240), Color.White );

            foreach(var laser in gameObjects.Lasers)
            {
                laser.Draw( spriteBatch );
            }

            foreach(var asteroid in gameObjects.Asteroids){
                asteroid.Draw( spriteBatch );
            }

            gameObjects.Shuttle.Draw( spriteBatch );

            spriteBatch.DrawString( font, score.ToString(), new Vector2 (100, 100), Color.Red );

            spriteBatch.End();

            base.Draw( gameTime );
        }
Esempio n. 22
1
 protected override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
     this.spriteBatch.DrawString(this.font, "", new Vector2(1f, 1f), Color.White, 0f, Vector2.Zero, (float)1f, SpriteEffects.None, 1f);
     this.spriteBatch.End();
 }
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
        {
            if (Animation == null)
            {
                throw new NotSupportedException("No animation is currently playing.");
            }

            time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            while (time > Animation.frameTime)
            {
                time -= Animation.frameTime;

                if (Animation.isLooping)
                {
                    frameIndex = (frameIndex + 1) % Animation.FrameCount;

                }
                else
                {
                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
                }
            }

            Rectangle source = new Rectangle(FrameIndex * Animation.FrameWidth, 0, Animation.FrameWidth, Animation.FrameHeight);

            spriteBatch.Draw(animation.texture, position, source, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
        }
Esempio n. 24
0
        public override void Draw(GameTime gameTime)
        {
            Matrix world = Matrix.CreateRotationY(this.rotation) * Matrix.CreateTranslation(this.position + (Vector3.Up * height));

            Matrix[] transforms = new Matrix[this.model.Bones.Count];
            this.model.CopyAbsoluteBoneTransformsTo(transforms);

            GraphicsDevice.BlendState = BlendState.AlphaBlend;
            GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = transforms[mesh.ParentBone.Index] * world;
                    effect.View = CanyonGame.Camera.View;
                    effect.Projection = CanyonGame.Camera.Projection;
                    effect.Alpha = this.alpha;
                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;
                }

                mesh.Draw();
            }

            base.Draw(gameTime);
        }
Esempio n. 25
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            //drawas all the objects to the game
            spriteBatch.Draw(Paddle, PaddlePos, Color.White);
            spriteBatch.Draw(Ball, BallPos, Color.White);
            spriteBatch.DrawString(Lives, "Lives = " + Numberlives, new Vector2(020,020), Color.White);
            spriteBatch.DrawString(Lives, "Score = " + score, new Vector2(580, 020), Color.White);

            //draws allthe bricks on the board
            foreach (var pos in BricksPos)
                spriteBatch.Draw(Block, pos, Color.Turquoise);

            // makes it so that if there are no more lives it displays some text to tell you
             if (Numberlives <= 0)
            {
                spriteBatch.DrawString(Lives, "You ran out of Lives, press [Esc] to leave", new Vector2(200, 400), Color.White);
             }

             if (score >= 300)
             {
                 spriteBatch.DrawString(Lives, "You won, GG press [Esc] to exit", score, new Vector2(200, 400), Color.White);
             }

            spriteBatch.End();
            base.Draw(gameTime);
        }
Esempio n. 26
0
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Vector2 _position2 = new Vector2(_position.X, _position.Y + 150);
            Vector2 _position3 = new Vector2(_position.X, _position.Y + 300);

            if (pause)
            {
                spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

                if (jouerIn)
                    spriteBatch.Draw(jouer, _position, Color.Blue);
                else
                    spriteBatch.Draw(jouer, _position, Color.White);

                if (OptionIn)
                    spriteBatch.Draw(options, _position2, Color.Blue);
                else
                    spriteBatch.Draw(options, _position2, Color.White);

                if (QuitterIn)
                    spriteBatch.Draw(quitter, _position3, Color.Blue);
                else
                    spriteBatch.Draw(quitter, _position3, Color.White);

            }
        }
Esempio n. 27
0
        public override void Update(GameTime gameTime)
        {
            ControlManager.Update(gameTime, PlayerIndex.One);

            base.Update(gameTime);

        }
Esempio n. 28
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);
            if (m_Delay > 0)
            {
                m_Delay -= gameTime.ElapsedGameTime.Milliseconds;
            }
            foreach (TPRollingTextMenuItem item in m_MenuItemSet)
            {
                item.Update(gameTime);
                if (!TPMath.IsWithinRange(item.Position, item.PositionTarget, 5.0f))
                {
                    item.Velocity = TPMath.GetDirectionVector(item.Position, item.PositionTarget) * 5;
                }
                else
                {
                    item.Velocity = Vector2.Zero;
                }

                if (item.Alpha < item.AlphaTarget)
                {
                    item.Alpha += 0.01f;
                }

                if (item.Alpha > item.AlphaTarget)
                {
                    item.Alpha -= 0.01f;
                }
                item.RenderColor = new Color((item.ColorTarget.R / 255) * item.Alpha, (item.ColorTarget.G / 255) * item.Alpha, (item.ColorTarget.B / 255) * item.Alpha, item.Alpha);

                if (!TPMath.IsWithinRange(item.Scale, item.ScaleTarget, 0.1f))
                {
                    item.Scale += TPMath.GetDirectionVector(item.Scale, item.ScaleTarget) / 20;
                }
            }
        }
Esempio n. 29
0
        public override void update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            // positionCloud.X+= 0.1f;

            if (clouds != null)
            {
                for (int i = 0; i < clouds.Count; i++)
                {
                    clouds.ElementAt(i).position.X += (i + 1) % 2 == 0 ? 0.1f : -0.1f;// = new Vector2(, (float)new Random().Next(0, 100));

                    if (clouds.ElementAt(i).position.X < (float)-clouds.ElementAt(i).texture.Width)
                    {
                        clouds.ElementAt(i).position.X = 800;
                    }

                    if (clouds.ElementAt(i).position.X > 800f)
                    {
                        clouds.ElementAt(i).position.X = -clouds.ElementAt(i).texture.Width;
                    }
                }
            }

            //for (int j = 0; j < cloudsPosition.Count / 2; j++)
            //{
            //    cloudsPosition.Remove(cloudsPosition.ElementAt(j));
            //}

            base.update(gameTime);

            tweener.Update(gameTime);
            position.Y = tweener.Position;
            //if (position.Y > 0)
            //    position.Y--;
            //else
            //    position.Y = 0;
        }
Esempio n. 30
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            float timeFactor = gameTime.ElapsedGameTime.Milliseconds / 1000.0f;

            if (timeFactor == 0.0f)
            {
                return;
            }

            float desiredChange = MathHelper.ToRadians(maxRotation) * timeFactor * -GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X;

            // rotate Orientation vector by desiredCharge
            Matrix rotation = Matrix.Identity;

            Matrix.CreateRotationZ(desiredChange, out rotation);

            Vector3 vDes = Vector3.Transform(owner.Orientation, rotation);

            vDes.Normalize();

            owner.Orientation = vDes;
            owner.Position    = owner.Position +
                                owner.Orientation * maxSpeed * GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.Y *timeFactor;
        }
Esempio n. 31
0
        public void Update(Microsoft.Xna.Framework.GameTime gametime)
        {
            VisualizationData vd = new VisualizationData();

            MediaPlayer.GetVisualizationData(vd);
            TextureLoader.Std.Parameters[0].SetValue(((vd.Samples.Average() < 0) ? 0 : vd.Samples.Average()) + vd.Samples.Max());

            /*for (int i = 0; i < 256; i++)
             * {
             *  (MainController.Instance.GetByName("ParticleController") as ParticleController).Beat(new Vector2(5 * i, 100), vd.Samples[i]);
             *  (MainController.Instance.GetByName("ParticleController") as ParticleController).Beat(new Vector2(5 * i, 300), vd.Frequencies[i]);
             * }*/
            for (int a = 52; a < 180; a++)
            {
                if (vd.Frequencies[a] > BEAT_REACTION && accomulator[a - 52] > ACCOMULATOR_REACTION)
                {
                    var meteor = ObjectContainer.Instance.TryGet(typeof(Meteor)) as Meteor;
                    if (meteor == null)
                    {
                        ObjectContainer.Instance.Add(new Meteor());
                    }
                    else
                    {
                        meteor.Reuse();
                    }
                    accomulator[a - 52] -= BEAT_COST; // убавляем аккумулятор
                }
            }
            for (int a = 52; a < 180; a++)
            {
                if (accomulator[a - 52] < 1.0f)
                {
                    accomulator[a - 52] += ACCUMULATE_SPEED;
                }
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Draw the cube
        /// </summary>
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Effect effect)
        {
            // Prepare the effect for drawing
            PrepareEffect(effect);

            // Disable lighting but remember whether it was switched on...
            bool lightingEnabled = ((BasicEffect)effect).LightingEnabled;

            ((BasicEffect)effect).LightingEnabled = false;
            // Disable the depth buffer
            DepthStencilState depthState = effect.GraphicsDevice.DepthStencilState;

            effect.GraphicsDevice.DepthStencilState = DepthStencilState.None;

            // Set the active vertex buffer
            effect.GraphicsDevice.SetVertexBuffer(_vertexBuffer);

            // Draw the object
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                // Apply the pass
                pass.Apply();
                // Draw the sky box
                effect.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, _vertices.Length / 3);
            }

            // Re-enable lighting and the depth buffer if required
            if (lightingEnabled)
            {
                ((BasicEffect)effect).LightingEnabled = true;
            }
            effect.GraphicsDevice.DepthStencilState = depthState;

            // Indicate that the skybox has been rendered this frame
            _renderedThisFrame = true;
        }
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Draw(gameTime);
            if (this.initialized)
            {
                spriteBatch.Begin();

                for (byte i = 0; i < collisions.Count; i++)
                {
                    Rectangle    rect = collisions[i];
                    TileBehavior b    = TileBehavior.GetBehavior(i);

                    spriteBatch.Draw(pixel, rect, b.Color);
                    const int font = 2;
                    FontRenderer.Instance.Draw(spriteBatch, b.Identifier, font, (int)(rect.X + 16 / 2 - Math.Floor(FontRenderer.Instance.Width(b.Identifier, font) / 2f)), rect.Y + 14);
                    if (i == this.SelectedId)
                    {
                        SelectionUtil.DrawRectangle(spriteBatch, Color.Red, new Rectangle(rect.X, rect.Y, rect.Width - 1, rect.Height - 1));
                    }
                }

                spriteBatch.End();
            }
        }
Esempio n. 34
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            try {
                //SETUP DRAWING
                RenderTarget2D target = new RenderTarget2D(GraphicsDevice, WIDTH, HEIGHT);
                GraphicsDevice.SetRenderTarget(target);
                GraphicsDevice.Clear(Color.BlanchedAlmond);

                if (Initialized && this.Scene != null)
                {
                    //PERFORM GAME DRAWING
                    base.Draw(gameTime);
                    Scene.Draw(gameTime);
                }

                //FINALIZE DRAWING
                GraphicsDevice.SetRenderTarget(null);
                SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
                SpriteBatch.Draw(target, new Rectangle(0, 0, (int)(WIDTH * SCALE), (int)(HEIGHT * SCALE)), Color.White);
                SpriteBatch.End();
            } catch (InvalidOperationException exc) {
                Console.WriteLine("IOE EXC");
            }
        }
Esempio n. 35
0
        public override int update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            time += gameTime.ElapsedGameTime;

            if (time.TotalSeconds < 3)
            {
                voiceDraw = voice[0];
            }
            else if (time.TotalSeconds < 6)
            {
                voiceDraw = voice[1];
            }
            else if (time.TotalSeconds < 9)
            {
                voiceDraw = voice[2];
            }
            else if (time.TotalSeconds < 12)
            {
                voiceDraw = voice[3];
            }
            else if (time.TotalSeconds < 15)
            {
                voiceDraw = voice[4];
            }
            else if (time.TotalSeconds < 18)
            {
                voiceDraw = voice[5];
            }

            else if (onStartClick() == Constants.CMD_NEW)
            {
                return(Constants.CMD_NEW);
            }

            return(Constants.CMD_NONE);
        }
        public override void Draw(Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer)
        {
            rHelper.PushRenderTarget(target);
            rHelper.Clear(Color.Black);
            effectdistorcion.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            effectdistorcion.Parameters["DEPTH"].SetValue(rHelper[PrincipalConstants.DephRT]);
            effectdistorcion.Parameters["DistortionScale"].SetValue(Distortion);
            rHelper.PushDepthStencilState(DepthStencilState.None);

            foreach (var obj in objs)
            {
                IModelo modelo = obj.Modelo;

                for (int i = 0; i < modelo.MeshNumber; i++)
                {
                    BatchInformation[] bi = modelo.GetBatchInformation(i);
                    for (int j = 0; j < bi.Count(); j++)
                    {
                        Matrix w = bi[j].ModelLocalTransformation * obj.WorldMatrix;
                        effectdistorcion.Parameters["WorldViewProjection"].SetValue(w * world.CameraManager.ActiveCamera.View * world.CameraManager.ActiveCamera.Projection);
                        effectdistorcion.Parameters["WorldView"].SetValue(w * world.CameraManager.ActiveCamera.View);
                        rHelper.RenderBatch(bi[j], effectdistorcion);
                    }
                }
            }

            rHelper.PopDepthStencilState();

            x = rHelper.PopRenderTargetAsSingleRenderTarget2D();

            rHelper.Clear(Color.Black);
            effect.Parameters["SceneTexture"].SetValue(ImageToProcess);
            effect.Parameters["DistortionMap"].SetValue(x);
            //effect.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle);
        }
Esempio n. 37
0
        /// <summary>
        /// Draw frame
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="offset"></param>
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Vector2 offset)
        {
            //base.Draw(gameTime, offset);

            _placingSprite.Draw(gameTime, offset - _source.Offset);

            _cursorDelete.Draw(gameTime, offset - _source.Position);
            _cursorStandard.Draw(gameTime, offset - _source.Position);

            _spriteLogo.Draw(gameTime, offset);
            _spriteTime.Draw(gameTime, offset);

            this.SceneLayer.SpriteBatch.DrawString(_fontTime, String.Format("{0}:{1:00}", Math.Floor((Double)_controller.PlayingTime.TotalMinutes), Math.Floor((Double)_controller.PlayingTime.Seconds)),
                                                   _spriteTime.Position + (_spriteTime.Size.X + 10) * Vector2.UnitX + Vector2.One - Vector2.UnitY * 10, Color.Black);
            this.SceneLayer.SpriteBatch.DrawString(_fontTime, String.Format("{0}:{1:00}", Math.Floor((Double)_controller.PlayingTime.TotalMinutes), Math.Floor((Double)_controller.PlayingTime.Seconds)),
                                                   _spriteTime.Position + (_spriteTime.Size.X + 10) * Vector2.UnitX - Vector2.UnitY * 10, Color.White);

            _spriteHappyPoints.Draw(gameTime, offset);

            this.SceneLayer.SpriteBatch.DrawString(_fontPoints, String.Format("{0:N0} ({1:##}M)", _displayScore, 20),
                                                   _spriteHappyPoints.Position + (_spriteHappyPoints.Size.X + 10) * Vector2.UnitX + Vector2.One - Vector2.UnitY * 10, Color.Black);
            this.SceneLayer.SpriteBatch.DrawString(_fontPoints, String.Format("{0:N0} ({1:##}M)", _displayScore, 20),
                                                   _spriteHappyPoints.Position + (_spriteHappyPoints.Size.X + 10) * Vector2.UnitX - Vector2.UnitY * 10, this.Color);
        }
Esempio n. 38
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (TheGame.Instance.getPlayer().getCollisionRectangle().Intersects(collisionObject.getCollisionRectangle()) && didFallThroughTheCrackAndActivatedTheCollisionThing == false)
            {
                TheGame.Instance.getPlayer().Die();
                TheGame.Instance.getPlayer().setJumpHigh(TheGame.Instance.getPlayer().getJumpHigh() * 2);
                didFallThroughTheCrackAndActivatedTheCollisionThing = true;
                addKey();

                platform2.setPosX(platform1.getCollisionRectangle().X + platform1.getCollisionRectangle().Width);
                platform2.setWidth(TheGame.Instance.map.Size.X - platform1.getCollisionRectangle().Width - 125);

                hole.setPosX(TheGame.Instance.map.Size.X - platform1.getCollisionRectangle().Width);
                hole.setWidth(125);
            }

            if (didFallThroughTheCrackAndActivatedTheCollisionThing == true)
            {
                if (TheGame.Instance.getPlayer().getCollisionRectangle().Intersects(key.getCollisionRectangle()))
                {
                    markAsComplete();
                }
            }
        }
Esempio n. 39
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            Game.GraphicsDevice.Clear(Color.Black);

            spriteBatch.DrawString(_text, _headText, new Vector2(20, 20), Color.Red);
            spriteBatch.DrawString(_text, _expl, new Vector2(20, 80), Color.White);
            Vector2 marginY = new Vector2(0, 30);

            spriteBatch.DrawString(_text, _contrText, new Vector2(20, 430) + marginY, Color.Red);
            spriteBatch.DrawString(_text, _arrows, new Vector2(20, 490) + marginY, Color.Red);
            spriteBatch.DrawString(_text, _contrExpl, new Vector2(20 + _text.MeasureString(_arrows).X, 490) + marginY, Color.White);
            spriteBatch.DrawString(_text, _button, new Vector2(20, 490 + _text.MeasureString(_contrExpl).Y) + marginY, Color.Red);


            spriteBatch.DrawString(_text, _contrExpl2, new Vector2(20 + _text.MeasureString(_button).X, 490 + _text.MeasureString(_contrExpl).Y) + marginY, Color.White);
            spriteBatch.DrawString(_text, _contrExpl4, new Vector2(20, 490 + _text.MeasureString(_contrExpl).Y + _text.MeasureString(_contrExpl2).Y) + marginY, Color.Red);
            spriteBatch.DrawString(_text, _contrExpl5, new Vector2(20 + _text.MeasureString(_contrExpl4).X, 490 + _text.MeasureString(_contrExpl).Y + _text.MeasureString(_contrExpl2).Y) + marginY, Color.White);

            spriteBatch.DrawString(_text, _contrExpl3, new Vector2(20, 640) + marginY, Color.White);

            spriteBatch.DrawString(_text, _esc1, new Vector2(600, 20), Color.White);
            spriteBatch.DrawString(_text, _esc2, new Vector2(600 + _text.MeasureString(_esc1).X, 20), Color.Red);
            spriteBatch.DrawString(_text, _esc3, new Vector2(600 + _text.MeasureString(_esc1).X + _text.MeasureString(_esc2).X, 20), Color.White);
        }
Esempio n. 40
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);

            if (screen.isActive && steamParticles != null)
            {
                if (steamParticles.isComplete)
                {
                    steamParticles = null;
                }
            }
            else if (screen.isActive && starParticles != null)
            {
                if (starParticles.isComplete)
                {
                    starParticles = null;
                }
                else
                {
                    int msDelay = 15;
                    prevMs += gameTime.ElapsedGameTime.Milliseconds;
                    if (prevMs > msDelay)
                    {
                        prevMs -= msDelay;
                        int pi = (int)Math.Min(roundScore / (laneCount - 1f), 7);
                        //starParticles.CreateInstanceAt("plpart" + pi, "pe", X + rnd.Next(40) - 20, Y + rnd.Next(40) - 20, 0, 0);
                        starParticles.CreateInstanceAt("plpart7", "pe", X + rnd.Next(40) - 20, Y + rnd.Next(40) - 20, 0, 0);
                        starParticles.SetParticleScale(pi / ((laneCount - 1f) * 3f) + .33f);
                    }
                }
            }
            else
            {
                this.SpeedLevel = SpeedLevel.Normal;
            }
        }
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     if (isMinimizing == true)
     {
         if (this.Height + titleSize > originalHeight)
         {
             this.Height -= 2;
             this.Y      += 2;
         }
         else
         if (stateChanged == true)
         {
             stateChanged = false;
             OnFinishedMinimizing();
         }
     }
     if (isMinimizing == false)
     {
         if (this.Height < originalHeight)
         {
             this.Height += 2;
             this.Y      -= 2;
         }
         else
         if (stateChanged == true)
         {
             if (Blocked == false && isSlidingOutY == false)
             {
                 titleRef.Visible = true;
                 OnFinishedMaximizing();
             }
             stateChanged = false;
         }
     }
     base.Update(gameTime);
 }
Esempio n. 42
0
        /// <summary>
        /// Draws this instance
        /// </summary>
        /// <param name="gameTime">The gametime</param>
        /// <param name="spriteBatch">The spriteBatch</param>
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            if (this.fontRenderer != null && Visible) // && CollisionModel.CollisionBoundry.Intersects(SceneManager.ActiveCamera.BoundingBox))
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, null, null, null, SceneManager.ActiveCamera.TransformMatrix);

                if (origin == Origins.TopLeft)
                {
                    this.fontRenderer.DrawText(spriteBatch, (int)Transform.Position.X, (int)Transform.Position.Y, this.text.ToString(), Transform.Scale.X, this.OverlayColor, this.lineSpacing, this.alignMode);
                }
                else
                {
                    Vector2 dest = fontRenderer.MeasureString(text, Transform.Scale.X, this.lineSpacing);
                    dest.X = Transform.Position.X - (dest.X - dest.X / 2);
                    dest.Y = Transform.Position.Y - (dest.Y - dest.Y / 2);

                    this.fontRenderer.DrawText(spriteBatch, (int)dest.X, (int)dest.Y, this.text.ToString(), Transform.Scale.X, this.OverlayColor, this.lineSpacing, this.alignMode);
                }

                spriteBatch.End();
            }
        }
Esempio n. 43
0
        public override void Iterate(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (!initialized)
            {
                subbehaviours = new AISubbehaviours(nodesToVisit.Count);
                if (character != null)
                {
                    // 1 add goto behaviour from character position to first node
                    AIBehaviour newBehaviour = new AIBehaviourGoTo();
                    newBehaviour.Character = this.character;
                    newBehaviour.Map       = this.map;

                    // loop
                    for (int index = 0; index < nodesToVisit.Count - 1; index++)
                    {
                        AIBehaviour newIBehaviour = new AIBehaviourGoTo();
                        newIBehaviour.Character = this.character;
                        newIBehaviour.Map       = this.map;
                        ((AIBehaviourGoTo)(newIBehaviour)).StartNode = nodesToVisit[index];
                        ((AIBehaviourGoTo)(newIBehaviour)).EndNode   = nodesToVisit[index + 1];
                        subbehaviours.Add(ref newIBehaviour);
                    }

                    newBehaviour           = new AIBehaviourGoTo();
                    newBehaviour.Character = this.character;
                    newBehaviour.Map       = this.map;
                    ((AIBehaviourGoTo)(newBehaviour)).StartNode = nodesToVisit[nodesToVisit.Count - 1];
                    ((AIBehaviourGoTo)(newBehaviour)).EndNode   = nodesToVisit[0];
                    subbehaviours.Add(ref newBehaviour);

                    // add goto behaviour from last position to first position
                }
                initialized = true;
            }
            base.Iterate(gameTime);
        }
Esempio n. 44
0
        protected override void DrawSelf(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            spriteBatch.End();

            foreach (var obj in DrawableUIElemts)
            {
                foreach (Control elemt in obj.GetDrawableElemt())
                {
                    renderer.Render(elemt, spriteBatch);
                }
            }

            spriteBatch.Begin();

            if (Status == S_Add)
            {
                CozyTiledFactory.GetInstance(CurrentTiledId).DrawAt(gameTime, spriteBatch, CurrentPosition.ToVector2(), NodeContentSize);
            }
            foreach (var obj in TempTiles)
            {
                var ActualPosition = CozyTiledPositionHelper.ConvertTiledPositionToPosition(obj.Key, NodeContentSize);
                CozyTiledFactory.GetInstance(obj.Value).DrawAt(gameTime, spriteBatch, ActualPosition, NodeContentSize);
            }
        }
Esempio n. 45
0
 protected override void DoFrame(Microsoft.Xna.Framework.GameTime i_GameTime)
 {
     this.BoundSprite.AngularVelocity = k_AngularVelocity * m_AngularVelocityDirection;
 }
Esempio n. 46
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     World.Step((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f);
 }
Esempio n. 47
0
 public void run(
     Microsoft.Xna.Framework.GameTime t, string function)
 {
     run(function);
 }
Esempio n. 48
0
 partial void GeneratedDraw(Microsoft.Xna.Framework.GameTime gameTime);
Esempio n. 49
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (playerBeenShot && this.Visible == true && timePlayerIsKilled < gameTime.TotalGameTime)
            {
                //player has been shot, reset
                this.Visible   = false;
                this.Texture   = this.Game.ShipTexture;
                playerBeenShot = false;
                this.Enabled   = false;
                return;
            }


            //player ship input controls
            KeyboardState keyboardState = Keyboard.GetState();

            if (this.Enabled && !playerBeenShot && this.Visible)
            {
                if (keyboardState.IsKeyDown(Keys.Left))
                {
                    this.Position = new Vector2(this.Position.X - 5, this.Position.Y);
                }
                if (keyboardState.IsKeyDown(Keys.Right))
                {
                    this.Position = new Vector2(this.Position.X + 5, this.Position.Y);
                }
                if (this.Position.X < 0)
                {
                    this.Position = new Vector2(0, this.Position.Y);
                }
                if (this.Position.X > this.Game.Graphics.PreferredBackBufferWidth - this.Texture.Width)
                {
                    this.Position = new Vector2(this.Game.Graphics.PreferredBackBufferWidth - this.Texture.Width, this.Position.Y);
                }
                //Moving up and down...
                if (keyboardState.IsKeyDown(Keys.Up))
                {
                    this.Position = new Vector2(this.Position.X, this.Position.Y - 5);
                }
                if (keyboardState.IsKeyDown(Keys.Down))
                {
                    this.Position = new Vector2(this.Position.X, this.Position.Y + 5);
                }
                if (this.Position.Y < 0)
                {
                    this.Position = new Vector2(this.Position.X, 0);
                }
                if (this.Position.Y > this.Game.Graphics.PreferredBackBufferHeight - this.Texture.Height)
                {
                    this.Position = new Vector2(this.Position.X, this.Game.Graphics.PreferredBackBufferHeight - this.Texture.Height);
                }
            }

            if (keyboardState.IsKeyDown(Keys.LeftControl) &&
                lastFireTimeFriend < gameTime.TotalGameTime &&
                !playerBeenShot && this.Visible)
            {
                BulletSprite bullet = new BulletSprite(this.Game.FriendBullet, this.Game, true, TimeSpan.FromSeconds(1));
                bullet.Position = new Vector2(this.Position.X + 17, this.Position.Y - 16);
                this.Game.Components.Add(bullet);

                this.Game.Sound = this.Game.Content.Load <SoundEffect>("fire");
                this.Game.Sound.Play();

                lastFireTimeFriend = gameTime.TotalGameTime.Add(TimeSpan.FromSeconds(0.2));
            }
        }
Esempio n. 50
0
        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
        {
            Unit u = gameWorld.Variables.Player;

            if (u != null)
            {
                if (u.UnitState != UnitState.dead)
                {
                    SpriteBatch spriteBatch = gameWorld.spriteBatch;
                    spriteBatch.Begin();
                    spriteBatch.Draw(background, position, Color.White);
                    if (!u.SkillControlUnit)
                    {
                        if (u.CurrentWeapon != null)
                        {
                            for (int i = 1; i <= u.maxWeaponNum; i++)
                            {
                                string k = i.ToString();
                                if (i <= 4)
                                {
                                    k = k + dpadShotcut[i - 1];
                                }

                                if (i == u.CurrentWeaponNumber + 1)
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, k, position + weaponInfPosition + new Vector2(40 * i, -10), Color.Yellow, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                                else if (i <= u.weapons.Count)
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, k, position + weaponInfPosition + new Vector2(40 * i, -10), Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                                else
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, k, position + weaponInfPosition + new Vector2(40 * i, -10), Color.Gray, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                            }
                            spriteBatch.DrawString(gameWorld.GameFont, u.CurrentWeapon.name, position + weaponInfPosition + new Vector2(10, 0), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.3f);
                            spriteBatch.DrawString(gameWorld.GameFont, u.CurrentWeapon.ammoName + " ", position + weaponInfPosition + new Vector2(30, 26), Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                            spriteBatch.DrawString(gameWorld.GameFont, ((int)u.CurrentWeapon.AmmoNum).ToString(), position + weaponInfPosition + new Vector2(25, 40), Color.White, 0, Vector2.Zero, 1.7f, SpriteEffects.None, 0.3f);
                        }
                        if (u.CurrentMissileWeapon != null)
                        {
                            spriteBatch.DrawString(gameWorld.GameFont, "(F/RB)" + u.CurrentMissileWeapon.missileWeaponType.name, position + missileInfPosition, Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                            spriteBatch.DrawString(gameWorld.GameFont, u.CurrentMissileWeapon.Num.ToString(), position + missileInfPosition + new Vector2(115, 0), Color.White, 0, Vector2.Zero, 1.1f, SpriteEffects.None, 0.3f);
                        }
                        if (u.CurrentSkill != null)
                        {
                            spriteBatch.DrawString(gameWorld.GameFont, "(R/LB)" + u.CurrentSkill.SkillName, position + skillInfPosition, Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                            if (u.CurrentSkill.CooldownRemain > 0)
                            {
                                spriteBatch.DrawString(gameWorld.GameFont, Math.Round(u.CurrentSkill.CooldownRemain, 1).ToString() + " / " + Math.Round(u.CurrentSkill.Cooldown, 1).ToString(), position + skillInfPosition + new Vector2(85, 0), Color.White, 0, Vector2.Zero, 1.1f, SpriteEffects.None, 0.3f);
                            }
                        }
                    }
                    else
                    {
                        if (u.CurrentSkill != null)
                        {
                            for (int i = 1; i <= u.maxSkillNum; i++)
                            {
                                if (i == u.CurrentSkillNumber + 1)
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, i.ToString(), position + weaponInfPosition + new Vector2(10 * i, -10), Color.Yellow, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                                else if (i <= u.skills.Count)
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, i.ToString(), position + weaponInfPosition + new Vector2(10 * i, -10), Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                                else
                                {
                                    spriteBatch.DrawString(gameWorld.GameFont, i.ToString(), position + weaponInfPosition + new Vector2(10 * i, -10), Color.Gray, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                                }
                            }
                            spriteBatch.DrawString(gameWorld.GameFont, u.CurrentSkill.SkillName, position + weaponInfPosition + new Vector2(10, 0), Color.White, 0, Vector2.Zero, 1.4f, SpriteEffects.None, 0.3f);
                            if (u.CurrentSkill.CooldownRemain > 0)
                            {
                                spriteBatch.DrawString(gameWorld.GameFont, Math.Round(u.CurrentSkill.CooldownRemain, 1).ToString() + " / " + Math.Round(u.CurrentSkill.Cooldown, 1).ToString(), position + weaponInfPosition + new Vector2(25, 40), Color.White, 0, Vector2.Zero, 1.3f, SpriteEffects.None, 0.3f);
                            }
                        }

                        if (u.CurrentMissileWeapon != null)
                        {
                            spriteBatch.DrawString(gameWorld.GameFont, "(F/RB)" + u.CurrentMissileWeapon.missileWeaponType.name, position + missileInfPosition, Color.White, 0, Vector2.Zero, 0.6f, SpriteEffects.None, 0.3f);
                            spriteBatch.DrawString(gameWorld.GameFont, u.CurrentMissileWeapon.Num.ToString(), position + missileInfPosition + new Vector2(85, 0), Color.White, 0, Vector2.Zero, 1.1f, SpriteEffects.None, 0.3f);
                        }
                    }


                    spriteBatch.End();
                }
            }
        }
 public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, DrawingUtils.MyGraphicsClass graphics)
 {
     base.Draw(gameTime, graphics);
     this.Collidable.Draw(graphics, this.Position, this.Direction);
 }
Esempio n. 52
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     base.Update(gameTime);
 }
Esempio n. 53
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime, EntityManager manager)
        {
            Behavior();

            base.Update(gameTime, manager);
        }
Esempio n. 54
0
        public override void Update(Microsoft.Xna.Framework.GameTime gametime)
        {
            base.Update(gametime);
            switch (Phase)
            {
            case ePhase.STARTUP:
                this.StartupPhase();
                break;

            case ePhase.DRAW:
                if (this.IsTurn == false)
                {
                    break;
                }
                MainDeck.DrawCard();
                Phase = ePhase.STANDBY;
                break;

            case ePhase.STANDBY:
                if (this.IsTurn == false)
                {
                    break;
                }
                Phase = ePhase.MAIN1;
                this.CurNormalSummon = this.MaxNormalSummon;
                break;

            case ePhase.MAIN1:
                if (this.Hand.IsAction == true)
                {
                    break;
                }

                if (this.Status == ePlayerStatus.IDLE)
                {
                    if (CurNormalSummon != 0 && this.MonsterField.Count < this.MonsterField.MaxCard)
                    {
                        this.SummonBuffer = this.m_Ai_logics.Summon(PlayScene.Player, this);
                    }
                    else
                    {
                        if (this.MonsterField.ListCard.Any(card => (card as Monster).CanATK))
                        {
                            if (tributemonster.Any() == false)
                            {
                                this.Phase = ePhase.BATTLE;
                            }
                        }
                        else
                        {
                            this.Phase = ePhase.END;
                        }
                        break;
                    }
                    if (SummonBuffer == null)
                    {
                        //this.SummonBuffer = this.m_Ai_logics.Set(PlayScene.Player, this);
                        this.Phase = ePhase.END;
                        break;
                    }
                    int tri = RequireTributer[(SummonBuffer as Monster).Level - 1];

                    tributemonster = new LinkedList <Card>(this.m_Ai_logics.Tribute(this, tri));

                    foreach (var item in tributemonster)
                    {
                        (item as Monster).CanATK = false;
                    }
                    if (tri > 0)
                    {
                        this.Status = ePlayerStatus.WAITFORTRIBUTE;
                    }
                    else
                    {
                        this.Status = ePlayerStatus.SUMONNING;
                        break;
                    }
                }
                if (this.Status == ePlayerStatus.WAITFORTRIBUTE)
                {
                    if (tributemonster.Any() == false)
                    {
                        this.Status = ePlayerStatus.SUMONNING;
                        break;
                    }
                    tributemonster.First().STATUS = STATUS.TRIBUTE;
                    (tributemonster.First() as Monster).CanATK = false;
                    this.Tribute(tributemonster.First());
                    tributemonster.RemoveFirst();
                }
                tribute = 0;

                break;

            case ePhase.BATTLE:

                if (this.MonsterField.IsAction == true)
                {
                    break;
                }
                if (this.MonsterField.ListCard.Any(card => (card as Monster).CanATK))
                {
                    if (PlayScene.battlePhase.Step == eBattleStep.ENDPHASE)
                    {
                        PlayScene.battlePhase.Begin(PlayScene.Player, this, ePlayerId.COMPUTER);
                    }
                }
                else
                {
                    this.Phase = ePhase.END;
                }
                break;

            case ePhase.MAIN2:
                break;

            case ePhase.END:
                Phase  = ePhase.DRAW;
                IsTurn = false;
                break;

            case ePhase.TEST:
                break;

            default:
                break;
            }
        }
 protected override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
 }
Esempio n. 56
0
 public override void Draw(Microsoft.Xna.Framework.GameTime gt, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Tantric.Graphical.Camera cam)
 {
     batch.Draw(m_Graphic, Position - cam.Position, null, Color.White, (float)Rotation - (float)cam.Rotation, m_Origin, (float)ScaleFactor.X, SpriteEffects.None, 1.0f);
 }
 /// <summary>
 /// Updates
 /// </summary>
 /// <param name="gt">The gt.</param>
 protected override void Update(Microsoft.Xna.Framework.GameTime gt)
 {
     // variable time step but never less then 30 Hz
     world.Step(Math.Min((float)gt.ElapsedGameTime.TotalSeconds, (1f / 30f)));
 }
Esempio n. 58
-1
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            currentstate = Keyboard.GetState();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();

            // TODO: Add your update logic here
            else
            {
                if (currentstate.IsKeyDown(Keys.A) && !oldstate.IsKeyDown(Keys.A))
                {
                    sounds[0].Play();
                    //var sd = soundEffects[0].CreateInstance();
                    //sd.IsLooped = false;
                    //sd.Play();
                    //sd.Dispose();
                }
                if (currentstate.IsKeyDown(Keys.R) && !oldstate.IsKeyDown(Keys.R)) { rd.BMS파일분석(); }
                if (currentstate.IsKeyDown(Keys.Y) && !oldstate.IsKeyDown(Keys.Y)) { rd.노트시간계산();sdmgr.시간들 = rd.시간들; }
                if (currentstate.IsKeyDown(Keys.S) && !oldstate.IsKeyDown(Keys.S))
                {
                    sdmgr.Play();
                    //var sd = soundEffects[1].CreateInstance();
                    //sd.Play();
                }

                oldstate = currentstate;
            }
            

            base.Update(gameTime);
        }
Esempio n. 59
-1
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // This game has a blue background. Why? Because!
            ScreenManager.GraphicsDevice.Clear(Color.CornflowerBlue);

            _backSpriteManager.Draw(gameTime);
            _midSpriteManager.Draw(gameTime);
            _frontSpriteManager.Draw(gameTime);

            // Our player and enemy are both actually just text strings.
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.DrawString(gameFont, _healthBar.GetH().ToString(),
                                   enemyPosition, Color.DarkRed);
            _healthBar.Draw();
            _spawner.Draw();
            spriteBatch.End();

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0 || pauseAlpha > 0)
            {
                float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

                ScreenManager.FadeBackBufferToBlack(alpha);
            }
        }
Esempio n. 60
-1
 /// <summary>
 /// Allows the game component to update itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Draw(GameTime gameTime)
 {
     GestionSprites.Begin();
     GestionSprites.DrawString(Font,TexteÀAfficher, Position, CouleurTexte,0,Origine,Échelle, SpriteEffects.None,1f);
     GestionSprites.End();
     base.Draw(gameTime);
 }