示例#1
0
 public PlayerTaipir(Vector2 location, WorldBase world, Player transformedFrom) : base(location, world, transformedFrom)
 {
     //this.gravityMultiplier = .3f;
     this.jumpForce = 10f;
     this.walkSpeed = .7f;
     this.width     = 40;
     this.height    = 40;
     this.detectionRadiousModifier = 1.5f;
     this.detectionLevel           = 1.5f;
     movementControlManger         = new TaiperStandardControlManager(this);
     currentControlManager         = movementControlManger;
     inventory.add(new Item_Totem_Blank(1));
     keyedItems[0] = new Item_Totem_Blank(1);
     selectedFrame = Game1.texture_tapir[0];
 }
示例#2
0
        public override void draw(SpriteBatch batch, GameTime time, Point offset, Color groundColor)
        {
            //base.draw(batch, time, offset, Color.Red);

            if (drawInventory)
            {
                inventory.draw(batch, time, new Point());
            }

            drawHealthBar(batch, time, offset);
            drawHungerBar(batch, time, offset);
            drawColdBar(batch, time, offset);
            drawSelectedTileIndicator(batch, time, offset);

            if (currentControlManager is TaiperStandardControlManager)
            {
                TaiperStandardControlManager current = (TaiperStandardControlManager)currentControlManager;
                if (current.percentageTicksHarvesting > 0)
                {
                    batch.Draw(Game1.block, new Rectangle(Game1.instance.graphics.PreferredBackBufferWidth / 2, Game1.instance.graphics.PreferredBackBufferHeight / 2, 30, 20), Color.DarkGray);
                    batch.Draw(Game1.block, new Rectangle(Game1.instance.graphics.PreferredBackBufferWidth / 2 + 3, Game1.instance.graphics.PreferredBackBufferHeight / 2, 24, (int)(current.percentageTicksHarvesting * 20)), world.decorator.colorManager.groundColor);
                }
            }



            SpriteEffects effect = SpriteEffects.None;

            if (velocity.X > 0)
            {
                effect = SpriteEffects.FlipHorizontally;
            }

            Rectangle defaultRect = getCollisionBox().ToRect();

            batch.Draw(selectedFrame, new Rectangle(defaultRect.X + offset.X + drawOffset.X, defaultRect.Y + offset.Y + drawOffset.Y, selectedFrame.Width, selectedFrame.Height), null, getDrawColor(groundColor, time), 0, Vector2.Zero, effect, 0);
        }