예제 #1
0
        ////////////////

        public override void PostDrawInInventory(SpriteBatch sb, Vector2 pos, Rectangle _1, Color drawColor, Color _2, Vector2 _3, float scale)
        {
            if (this.StoredItemStackSize == 0)
            {
                return;
            }

            float timeLeftPercent;

            if (!this.ComputeTimeLeftPercent(out timeLeftPercent))
            {
                return;
            }

            Texture2D tupperTex = ModContent.GetTexture(this.Texture);

            if (timeLeftPercent == 0)
            {
                StarvationItem.DrawSpoilageInventory(sb, tupperTex, pos, drawColor, scale);
            }
            else
            {
                TupperwareItem.DrawContainerItemInventory(sb, this.StoredItemType, pos, scale);
                StarvationItem.DrawFreshnessGaugeInventory(sb, tupperTex, pos, timeLeftPercent, scale);
            }

            TupperwareItem.DrawItemStackInventory(sb, pos, this.StoredItemStackSize, scale);
        }
예제 #2
0
        public static bool PredictMaxElapsedTicksOfItem(Item item, out int maxElapsedTicks)
        {
            var            mymod  = StarvationMod.Instance;
            StarvationItem myitem = item.GetGlobalItem <StarvationItem>();

            bool  isValid = myitem.ComputeMaxElapsedTicks(item, out maxElapsedTicks);
            float maxElapsedTicksScaled = (float)maxElapsedTicks * mymod.Config.TupperwareSpoilageDurationScale;

            maxElapsedTicks = (int)maxElapsedTicksScaled;
            return(isValid);
        }
예제 #3
0
        public override void PostDrawInWorld(SpriteBatch sb, Color lightColor, Color _1, float _2, float scale, int whoAmI)
        {
            if (this.StoredItemStackSize == 0)
            {
                return;
            }

            float timeLeftPercent;

            if (!this.ComputeTimeLeftPercent(out timeLeftPercent))
            {
                return;
            }

            if (timeLeftPercent == 0)
            {
                StarvationItem.DrawSpoilageWorld(sb, this.item.Center, lightColor, scale);
            }
        }
예제 #4
0
        ////////////////

        public bool ComputeMaxElapsedTicks(out int maxElapsedTicks)
        {
            if (this.StoredItemStackSize == 0)
            {
                maxElapsedTicks = 0;
                return(false);
            }

            var            mymod  = (StarvationMod)this.mod;
            StarvationItem myitem = this.GetCachedModItem();

            if (!myitem.ComputeMaxElapsedTicks(this._CachedItem, out maxElapsedTicks))
            {
                return(false);
            }
            float maxElapsedTicksScaled = (float)maxElapsedTicks * mymod.Config.TupperwareSpoilageDurationScale;

            maxElapsedTicks = (int)maxElapsedTicksScaled;
            return(true);
        }