Ejemplo n.º 1
0
        public static void constructor(Particle p, Simulation sim)
        {
            SPARK e = (p.elem as SPARK);

            p.color = Util.MixColors(e.baseElem.color, Color.FromArgb(255, 255, 65), 0.2);
            p.step  = sim.step;
        }
Ejemplo n.º 2
0
        public static void update(Particle p, Simulation sim)
        {
            SPARK e = (p.elem as SPARK);

            e.baseElem.Update(p, sim);

            if (e.sparkTimer == 0)
            {
                sim.RemoveDecorator(p.x, p.y);
                p.timer = e.conductivity +
                          e.currentWidth + e.interCurrentWidth;
            }
            else
            {
                p.temperature += 0.5;

                if (e.sparkTimer == e.currentWidth)
                {
                    for (int y = -2; y <= 2; ++y)
                    {
                        for (int x = -2; x <= 2; ++x)
                        {
                            int nx = p.x + x;
                            int ny = p.y + y;
                            if (sim.BoundsCheck(nx, ny) && Math.Abs(x) + Math.Abs(y) != 4)
                            {
                                if (sim.pmap[ny, nx] != null &&
                                    (sim.pmap[ny, nx].elem.prop & CONST.PROP_CONDUCTIVE) != 0)
                                {
                                    sim.SetDecorator(nx, ny, typeof(SPARK));
                                }
                            }
                        }
                    }
                }

                --e.sparkTimer;
            }
        }