示例#1
0
 //draw the frame, no stretching.
 public void Draw(AD2SpriteBatch sb, int x, int y, Color tint)
 {
     if (CurrentAnimation != null)
     {
         CurrentAnimation.Draw(sb, XFrame, YFrame, x, y, tint);
     }
 }
示例#2
0
 //draw the frame, but can be stretched
 public void Draw(AD2SpriteBatch sb, int x, int y, int w, int h)
 {
     if (CurrentAnimation != null)
     {
         CurrentAnimation.Draw(sb, XFrame, YFrame, x, y, w, h);
     }
 }
示例#3
0
        public override void Render(Canvas2D canvas)
        {
            base.Render(canvas);

            if (CurrentAnimation != null && CurrentAnimation.Frames.Count > 0)
            {
                canvas.DrawText(Font, Vector2.Zero,
                                string.Format("Frame: {0}/{1} | Offset: {2};{3} | Origin:{4};{5}",
                                              CurrentAnimation.CurrentFrameIndex + 1, CurrentAnimation.Frames.Count,
                                              CurrentAnimation.CurrentFrame.OffSetX,
                                              CurrentAnimation.CurrentFrame.OffSetY,
                                              (int)CurrentAnimation.CurrentFrame.OriginX,
                                              (int)CurrentAnimation.CurrentFrame.OriginY), ColorU.White);
                using (canvas <= Camera.Transformation)
                {
                    CurrentAnimation.Draw(canvas);
                    if (_drawFrameDebug && CurrentAnimation.Frames.Count > 0)
                    {
                        Frame curFrame = CurrentAnimation.CurrentFrame;
                        canvas.DrawRect(
                            Rect.FromBox(curFrame.OffSetX - curFrame.SpriteFrame.Width / 2f,
                                         curFrame.OffSetY - curFrame.SpriteFrame.Height / 2, curFrame.SpriteFrame.Width,
                                         curFrame.SpriteFrame.Height), ColorU.Red);
                        canvas.DrawLine(-5, 0, 5, 0, _originMarkLineStyle, ColorU.GreenYellow);
                        canvas.DrawLine(0, -5, 0, 5, _originMarkLineStyle, ColorU.GreenYellow);
                    }
                }
            }

            guiManager.DrawControls(canvas);
        }
示例#4
0
 public override void Draw(GameTime gameTime, SpriteBatch batch)
 {
     base.Draw(gameTime, batch);
     if (CurrentAnimation != null)
     {
         CurrentAnimation.Draw(batch);
     }
 }
示例#5
0
        public void Draw(SpriteBatch sb)
        {
            var flip = (Direction == FaceDirection.Left);

            if (CurrentAnimation != null)
            {
                CurrentAnimation.Draw(sb, (flip ? SpriteEffects.FlipHorizontally : SpriteEffects.None), Transform.Position, Rotation, 0.5f, Color.White, AnimationEffect.None);
            }
        }
示例#6
0
        public void Draw(SpriteBatch sb)
        {
            var effect = InvulnerabilityTimer > 0 ? AnimationEffect.FlashWhite : AnimationEffect.None;

            if (CurrentAnimation != null)
            {
                CurrentAnimation.Draw(sb, (Direction == FaceDirection.Left ? SpriteEffects.FlipHorizontally : SpriteEffects.None), Transform.Position, 0, 1f, Color.White, effect);
            }
        }
示例#7
0
 public void Draw(SpriteBatch sb)
 {
     if (InvulnerabilityTimer > 0)
     {
         var def = (CurrentAnimation.Frames[CurrentAnimation.currentFrame] as SpriteAnimationFrameSpriteSheet);
         sb.Draw(def.spriteSheet, Transform.Position, def.definition.SrcRectangle, Color.White, 0f, def.definition.Origin, 1, effects: Direction == FaceDirection.Left ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth: 1.0f);
     }
     else
     {
         var effect = InvulnerabilityTimer > 0 ? AnimationEffect.FlashWhite : AnimationEffect.None;
         if (CurrentAnimation != null)
         {
             CurrentAnimation.Draw(sb, (Direction == FaceDirection.Left ? SpriteEffects.FlipHorizontally : SpriteEffects.None), Transform.Position, 0, 1f, Color.White, effect);
         }
     }
 }
示例#8
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            CurrentAnimation.Draw(spriteBatch, Position, PositionZ, FacingLeft, Tint);
            if (CharacterState == CharacterStates.PickState)
            {
                spriteBatch.Draw(PickHealthBarSprite, new Rectangle(Hitbox.Center.X - PickHealthBarSprite.Bounds.Center.X, (int)Position.Y - 20, PickHealthBarSprite.Width * PickHealth / MaxPickHealth, PickHealthBarSprite.Height), Color.White);
            }
            else if (CharacterState == CharacterStates.PassState)
            {
                LinkedListNode <Buttons> passButtonNode = InputManager.PassButtons.First;
                foreach (Player targetPlayer in PlayerManager.Players)
                {
                    if (targetPlayer.PlayerIndex == Player.PlayerIndex)
                    {
                        continue;
                    }
                    if (targetPlayer.Character.CharacterState == CharacterStates.StunnedState)
                    {
                        passButtonNode = passButtonNode.Next;
                        continue;
                    }

                    Texture2D buttonTexture = ContentManager.Load <Texture2D>("Button" + passButtonNode.Value.ToString());
                    int       yPos          = 40;
                    if (targetPlayer.Character.CharacterState == CharacterStates.PickState)
                    {
                        yPos += 10;
                    }
                    spriteBatch.Draw(buttonTexture, new Vector2(targetPlayer.Character.Hitbox.Center.X - buttonTexture.Width * .5F / 2F, (int)targetPlayer.Character.Position.Y - (int)targetPlayer.Character.PositionZ - yPos),
                                     null, Color.White, 0, new Vector2(0, 0), .5F, SpriteEffects.None, 0);
                    passButtonNode = passButtonNode.Next;
                }
            }
            if (DrawHealthBar)
            {
                spriteBatch.Draw(PickHealthBarSprite, new Rectangle(Hitbox.Center.X - PickHealthBarSprite.Bounds.Center.X, (int)Position.Y - 10 - (int)PositionZ, PickHealthBarSprite.Width * Health / MaxHealth, PickHealthBarSprite.Height), Color.Green);
            }
            //spriteBatch.Draw(ContentManager.Load<Texture2D>("Black"), Hitbox, Color.Blue);
            //spriteBatch.Draw(ContentManager.Load<Texture2D>("Black"), AttackHitbox, Color.Red);
        }
示例#9
0
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     CurrentAnimation.Draw(spriteBatch, Position, FacingLeft, scale);
     //spriteBatch.Draw(contentManager.Load<Texture2D>("Black"), Hitbox, Color.Blue);
     //spriteBatch.Draw(contentManager.Load<Texture2D>("Black"), AttackHitbox, Color.Red);
 }
示例#10
0
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     //spriteBatch.Draw(Sprite, new Rectangle((int)Position.X, (int)Position.Y, Sprite.Width, Sprite.Height), Color.White);
     CurrentAnimation.Draw(spriteBatch, Position, FacingLeft);
 }