public void Paint(PaintArgs args) { // Check if the actor is valid for this paint operation. if (lastPaintType != args.PaintType) { // Invalid actor. Change it. currentActor.Clear(); currentActor = actors[args.PaintType]; } lastPaintType = args.PaintType; // Let the actor paint. currentActor.Paint(args); }