Exemple #1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            skeleton.UpdateWorldTransform();

            spriteBatch.End();

            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            spriteBatch.Begin(SpriteSortMode.Immediate,
                              BlendState.AlphaBlend,
                              null,
                              null,
                              null,
                              null,
                              MediaManager.cam.get_transformation(graphics));

            bounds.Update(skeleton, true);

            /* MouseState mouse = Mouse.GetState();
             * headSlot.G = 1;
             * headSlot.B = 1;
             * if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
             * {
             *   BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
             *   if (hit != null)
             *   {
             *       headSlot.G = 0;
             *       headSlot.B = 0;
             *   }
             * } */
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            if (skeleton.X > 640 || skeleton.X < 0)
            {
                speed          = -1 * speed;
                skeleton.FlipX = !skeleton.FlipX;
            }

            skeleton.X += speed;

            skeleton.UpdateWorldTransform();
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);
            MouseState mouse = Mouse.GetState();

            headSlot.G = 1;
            headSlot.B = 1;
            if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
            {
                BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
                if (hit != null)
                {
                    headSlot.G = 0;
                    headSlot.B = 0;
                }
            }
        }
 public void Update(GameTime gameTime)
 {
     state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
     state.Apply(skeleton);
     skeleton.UpdateWorldTransform();
     bounds.Update(skeleton, true);
 }
        public void Update()
        {
            SkeletonBounds.Update(Skeleton, true);
            if (!Playing)
            {
                return;
            }
            AnimationState.Update(GameSpeed.TickDuration);

            AnimationState.Apply(Skeleton);
            AnimationTime += GameSpeed.TickDuration;
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            state.Apply(skeleton);

            skeleton.UpdateWorldTransform();

            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);

            /*MouseState mouse = Mouse.GetState();
             * if (headSlot != null)
             * {
             *      headSlot.G = 1;
             *      headSlot.B = 1;
             *      if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
             *      {
             *              BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
             *              if (hit != null)
             *              {
             *                      headSlot.G = 0;
             *                      headSlot.B = 0;
             *              }
             *      }
             * }*/

            spriteBatch.Begin();
            if (gameTime.TotalGameTime.TotalSeconds < 3)
            {
                spriteBatch.DrawString(font, "Press [Left] [Right] [Up] [Down] [Shift] for navigation.", new Vector2(20, 10), Color.White);
            }
            else
            {
                spriteBatch.DrawString(font, "", new Vector2(0, 0), Color.White);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            state.Apply(skeleton);
            skeleton.UpdateWorldTransform();
            if (skeletonRenderer.Effect is BasicEffect)
            {
                ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0);
            }
            else
            {
                skeletonRenderer.Effect.Parameters["Projection"].SetValue(Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0));
            }
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);
            MouseState mouse = Mouse.GetState();

            if (headSlot != null)
            {
                headSlot.G = 1;
                headSlot.B = 1;
                if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
                {
                    BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
                    if (hit != null)
                    {
                        headSlot.G = 0;
                        headSlot.B = 0;
                    }
                }
            }

            base.Draw(gameTime);
        }