コード例 #1
0
        public static Color GetPaintColor(Item paintItem)
        {
            BlasterPaintType paintType = PaintBlasterHelpers.GetPaintType(paintItem);
            Color            color;

            switch (paintType)
            {
            case BlasterPaintType.Can:
                color = WorldGen.paintColor(paintItem.paint);
                break;

            case BlasterPaintType.ColorCartridge:
                var mycolorcart = (ColorCartridgeItem)paintItem.modItem;
                color = mycolorcart.MyColor;
                break;

            case BlasterPaintType.GlowCartridge:
                var myglowcart = (GlowCartridgeItem)paintItem.modItem;
                color = myglowcart.MyColor;
                break;

            default:
                throw new ModHelpersException("Not implemented.");
            }
            return(color);
        }
コード例 #2
0
        ////////////////

        public static void ConsumePaint(Item paintItem, float amount)
        {
            BlasterPaintType paintType = PaintBlasterHelpers.GetPaintType(paintItem);

            switch (paintType)
            {
            case BlasterPaintType.Can:
                paintItem.stack -= (int)amount;
                if (paintItem.stack < 0)
                {
                    paintItem.stack = 0;
                }
                break;

            case BlasterPaintType.ColorCartridge:
                var mycolorcart = (ColorCartridgeItem)paintItem.modItem;
                mycolorcart.ConsumePaint(amount);
                break;

            case BlasterPaintType.GlowCartridge:
                var myglowcart = (GlowCartridgeItem)paintItem.modItem;
                myglowcart.ConsumePaint(amount);
                break;

            default:
                throw new ModHelpersException("Not implemented.");
            }
        }
コード例 #3
0
        public static byte GetPaintGlow(Item paintItem)
        {
            BlasterPaintType paintType = PaintBlasterHelpers.GetPaintType(paintItem);
            byte             glow;

            switch (paintType)
            {
            case BlasterPaintType.Can:
                glow = 0;
                break;

            case BlasterPaintType.ColorCartridge:
                glow = 0;
                break;

            case BlasterPaintType.GlowCartridge:
                glow = 255;
                break;

            default:
                throw new ModHelpersException("Not implemented.");
            }

            return(glow);
        }
コード例 #4
0
        public static float GetPaintAmount(Item paintItem)
        {
            BlasterPaintType paintType = PaintBlasterHelpers.GetPaintType(paintItem);

            switch (paintType)
            {
            case BlasterPaintType.Can:
                return(paintItem.stack);

            case BlasterPaintType.ColorCartridge:
                var mycolorcart = (ColorCartridgeItem)paintItem.modItem;
                return(mycolorcart.Quantity);

            case BlasterPaintType.GlowCartridge:
                var myglowcart = (GlowCartridgeItem)paintItem.modItem;
                return(myglowcart.Quantity);

            default:
                throw new ModHelpersException("Not implemented.");
            }
        }