Esempio n. 1
0
 public bool IsOver()
 {
     for (int i = 0; i < mDataPoints.Length; i++)
     {
         EraserPoint point = mDataPoints[i];
         if (point.flag)
         {
             continue;
         }
         bool ret = false;
         for (int x = point.x - 4; x <= point.x + 4; x++)
         {
             for (int y = point.y - 4; y <= point.y + 4; y++)
             {
                 if (texRender.GetPixel(x, y).a == 0)
                 {
                     mDataPoints[i].flag = ret = true;
                     break;
                 }
             }
             if (ret)
             {
                 break;
             }
         }
         if (!ret)
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 2
0
    public void Set(int w, int h)
    {
        int w2 = w / 2 - 8;
        int h2 = h / 2 - 8;

        mDataPoints[0] = new EraserPoint(ctx - w2, cty - h2, false);
        mDataPoints[1] = new EraserPoint(ctx - w2, cty, false);
        mDataPoints[2] = new EraserPoint(ctx - w2, cty + h2, false);

        mDataPoints[3] = new EraserPoint(ctx, cty - h2, false);
        mDataPoints[4] = new EraserPoint(ctx, cty, false);
        mDataPoints[5] = new EraserPoint(ctx, cty + h2, false);

        mDataPoints[6] = new EraserPoint(ctx + w2, cty - h2, false);
        mDataPoints[7] = new EraserPoint(ctx + w2, cty, false);
        mDataPoints[8] = new EraserPoint(ctx + w2, cty + h2, false);

        Reset();

        isGame = true;
    }