Example #1
0
 /// <summary>
 /// Decorator pattern.
 /// </summary>
 /// <param name="blockCount"></param>
 public int changeSkin_forTest(int blockCount, TowerConroller t)
 {
     if (blockCount == 0)
     {
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.draw();
     }
     else if (t.getPerfectDrop())
     {
         Settings.BlockWidth    = blockFactory.getBlock("SQUARE");
         Settings.block.Stretch = Stretch.Fill;
         Skin doublePoints = new DoublePointsDecorator(new DoublePointsSkin());
         doublePoints.draw();
     }
     else
     {
         Settings.BlockWidth    = blockFactory.getBlock("RECTANGLE");
         Settings.block.Stretch = Stretch.Fill;
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.draw();
     }
     return(Settings.points);
 }
Example #2
0
 private int changeEnemySkin(int blockCount)
 {
     if (blockCount == 0)
     {
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.drawEnemy();
     }
     else if (tower.getPerfectDrop())
     {
         Settings.BlockWidth         = blockFactory.getBlock("SQUARE");
         Settings.enemyBlock.Stretch = Stretch.Fill;
         Skin doublePoints = new DoublePointsDecorator(new DoublePointsSkin());
         doublePoints.drawEnemy();
     }
     else
     {
         Settings.BlockWidth         = blockFactory.getBlock("RECTANGLE");
         Settings.enemyBlock.Stretch = Stretch.Fill;
         Skin normalPoints = new NormalPointsDecorator(new DefaultSkin());
         normalPoints.drawEnemy();
     }
     return(Settings.points);
 }