/**
  * Construct a model with the given PaintTool as start PaintTool
  **/
 internal Model(PaintTool initPaintTool, ColorTool initColorTool)
 {
     setUpFactories(initColorTool);
     currentFactory = Factories[initPaintTool.type];
     currentFactory.ChangePaintTool(initPaintTool, initColorTool);
     currentColorTool = initColorTool;
 }
 internal void setBackGorundColorRandomly()
 {
     ColorTool ct = new ColorTool("random", "null", 0, 360, 0.9, 1, 0.9, 1);
     Color color = ct.getRandomShade(255);
     canvas.SetBackGroundColor(color);
 }
 internal void ChangeColorTool(ColorTool newColorTool)
 {
     currentColorTool = newColorTool;
     currentFactory.ChangeColorTool(currentColorTool);
 }
 internal abstract void ChangeColorTool(ColorTool newColorTool);
 //TODO see if logic for this could be done clearer
 internal abstract void ChangePaintTool(PaintTool newTool, ColorTool presentColorTool);
 protected BaseFactory(ColorTool initColorTool)
 {
     presentColorTool = initColorTool;
 }
 /**
  * Apply the new tool to the Factory
  */
 internal override void ChangePaintTool(PaintTool newTreeTool, ColorTool presentColorTool)
 {
     TreeTool newTool = (TreeTool)newTreeTool; // TODO Is there any way TODO this without casting?
     treeAdded = false;
     this.presentTreeTool = newTool;
     this.presentColorTool = presentColorTool;
     this.growthSpeed = presentTreeTool.growthSpeed;
     growthCount = 0;
 }
 internal override void ChangeColorTool(ColorTool newColorTool)
 {
     presentColorTool = newColorTool;
 }
 internal TreeFactory(ColorTool initColorTool)
     : base(initColorTool)
 {
     renderQueue = new Queue<RenderObject>();
     presentColorTool = initColorTool;
 }
Esempio n. 10
0
 /**
  * Set up the factories dictionary with all available PaintoolTypes mapped to their Factory.
  **/
 //TODO Add more factories here when more toolTypes are added
 void setUpFactories(ColorTool initColorTool)
 {
     Factories = new Dictionary<PaintToolType, BaseFactory>();
     Factories.Add(PaintToolType.TREE, new TreeFactory(initColorTool));
 }