@Override public boolean damage(final VectorI pixel) { if (states.change(pixel, PixelState.UNDAMAGED, PixelState.CLEAR)) { addDamage(1); return true; } return false; }
public Bullet( final Color color, final VectorI pixelCount, final VectorF pixelOffsetSize, final float maxLifetime) { this.color = color; pixels = new ColorPixelModel(pixelCount, pixelOffsetSize); states = new PixelStateModel(pixelCount); states.setAll(PixelState.UNDAMAGED); pixels.getColors().setAll(Colorizer.colorize(200, color).makeCssColor()); tracker = new PixelStatePointCountTracker(PixelState.UNDAMAGED); tracker.track(states); maxDamage = pixelCount.getArea(); }
public int damageAroundPoint(final VectorI point, final int max) { final int count = states.changeAroundPoint(point, PixelState.UNDAMAGED, PixelState.CLEAR, max); addDamage(count); return count; }
@Override public void resetDamagedPixels() { states.setAll(PixelState.UNDAMAGED); damage = 0; }