Exemplo n.º 1
0
 void CalculateFireDiraction()
 {
     FireLength = bomberman.GetFireLength();
     //LEFT
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x - i, transform.position.y), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x - i, transform.position.y), 0.1f, BrickLayer))
         {
             CellsToBlowLeft.Add(new Vector2(transform.position.x - i, transform.position.y));
             break;
         }
         CellsToBlowLeft.Add(new Vector2(transform.position.x - i, transform.position.y));
     }
     //RIGTH
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x + i, transform.position.y), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x + i, transform.position.y), 0.1f, BrickLayer))
         {
             CellsToBlowRight.Add(new Vector2(transform.position.x + i, transform.position.y));
             break;
         }
         CellsToBlowRight.Add(new Vector2(transform.position.x + i, transform.position.y));
     }
     //UP
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y + i), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y + i), 0.1f, BrickLayer))
         {
             CellsToBlowUp.Add(new Vector2(transform.position.x, transform.position.y + i));
             break;
         }
         CellsToBlowUp.Add(new Vector2(transform.position.x, transform.position.y + i));
     }
     //DOWN
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y - i), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y - i), 0.1f, BrickLayer))
         {
             CellsToBlowDown.Add(new Vector2(transform.position.x, transform.position.y - i));
             break;
         }
         CellsToBlowDown.Add(new Vector2(transform.position.x, transform.position.y - i));
     }
 }
Exemplo n.º 2
0
 void CalculateFireDirections()
 {
     FireLength = Bomber.GetFireLength();
     //L
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x - i, transform.position.y), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x - i, transform.position.y), 0.1f, BlowableLayer))
         {
             CellsToBlowL.Add(new Vector2(transform.position.x - i, transform.position.y));
             break;
         }
         CellsToBlowL.Add(new Vector2(transform.position.x - i, transform.position.y));
     }
     //R
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x + i, transform.position.y), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x + i, transform.position.y), 0.1f, BlowableLayer))
         {
             CellsToBlowR.Add(new Vector2(transform.position.x + i, transform.position.y));
             break;
         }
         CellsToBlowR.Add(new Vector2(transform.position.x + i, transform.position.y));
     }
     //U
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y + i), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y + i), 0.1f, BlowableLayer))
         {
             CellsToBlowU.Add(new Vector2(transform.position.x, transform.position.y + i));
             break;
         }
         CellsToBlowU.Add(new Vector2(transform.position.x, transform.position.y + i));
     }
     //D
     for (int i = 1; i <= FireLength; i++)
     {
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y - i), 0.1f, StoneLayer))
         {
             break;
         }
         if (Physics2D.OverlapCircle(new Vector2(transform.position.x, transform.position.y - i), 0.1f, BlowableLayer))
         {
             CellsToBlowD.Add(new Vector2(transform.position.x, transform.position.y - i));
             break;
         }
         CellsToBlowD.Add(new Vector2(transform.position.x, transform.position.y - i));
     }
 }