public override void DrawInContainer(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, SignsOfLife.UI.Containers.Container container, Color tintColor, Color behindTint)
        {
            Vector2 position = new Vector2((float)this._localPosX * Container.CONTAINER_SCALE_VECTOR.X + container.X, (float)this._localPosY * Container.CONTAINER_SCALE_VECTOR.Y + container.Y);
            Rectangle noChargedOverlay = new Rectangle((int)position.X,(int)position.Y,_rectSourceNoPower.Width,_rectSourceNoPower.Height);
            Rectangle chargedOverlay = noChargedOverlay;
            Rectangle chargedSource = _rectSourcePowered;
            int diff = (int)((float)chargedOverlay.Height*(Charge/MaxCharge));
            chargedOverlay.Y += chargedOverlay.Height-diff;
            chargedOverlay.Height = diff;
            chargedSource.Y += chargedSource.Height-diff;
            chargedSource.Height = diff;
            //

            SpriteEffects effects = SpriteEffects.None;
            if (base.IsFlipped)
            {
                effects = SpriteEffects.FlipHorizontally;
            }
            if (this._amount == 1)
            {
                spriteBatch.Draw(this._texture, noChargedOverlay, new Rectangle?(_rectSourceNoPower), tintColor, 0f, Vector2.Zero, effects, 0f);
                spriteBatch.Draw(this._texture, chargedOverlay, new Rectangle?(chargedSource), tintColor, 0f, Vector2.Zero, effects, 0f);
                return;
            }
            spriteBatch.Draw(this._texture, position+new Vector2(this.MULTIPLE_QUANTITY_SHIFT,0), new Rectangle?(this._spriteBounds), behindTint, 0f, Vector2.Zero, Container.CONTAINER_SCALE_VECTOR, effects, 0f);
            spriteBatch.Draw(this._texture, position, new Rectangle?(this._spriteBounds), tintColor, 0f, Vector2.Zero, Container.CONTAINER_SCALE_VECTOR, effects, 0f);
        }
Beispiel #2
0
        public override void Collided(SignsOfLife.BoxSide side, Map map)
        {
            base.Collided(side, map);
            if (IsOnGround())
            {
                SetMovingStart();
            }

            if (side == BoxSide.RIGHT || side == BoxSide.LEFT)
            {
                //IsFlipped = !IsFlipped;
                Speed = -Speed/2F;//Collided
                _hasCollided = true;
                EvaluateMovingState();
            }
        }
Beispiel #3
0
        public override void Update(GameTime gameTime, SignsOfLife.Maps.Map map)
        {
            if (base.IsOnGround())
            {
                var item = TrySelectFallenItem();

                if (item != null)
                {
                    //base.GetContainerUI().AddItemAutoStackRandom(InventoryItemHandler.CopyInventoryItem(item));
                    //item.RemoveSelf();
                    item._map.RemoveItemFromWorld(item);
                    //base.GetContainerUI().AddItemAutoStack(item);
                }
            }

            base.Update(gameTime, map);
        }