예제 #1
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        BloodTile bloodTile = other.gameObject.GetComponent <BloodTile>();

        if (bloodTile)
        {
            if (!bloodTile.isBloody)
            {
                bloodTile.isBloody = true;
                hasTile            = true;
                GameManager.Instance.currentBloodCount++;
            }
        }
    }
예제 #2
0
 public void GenerateBloodTiles()
 {
     // Generate the array of tiles to be marked as bloody
     for (int i = 0; i < bloodyTiles.GetLength(0); i++)
     {
         float yPos = yTileOffset + (i * bloodTile.ySize) * -1;
         for (int j = 0; j < bloodyTiles.GetLength(1); j++)
         {
             float     xPos        = xTileOffset + (j * bloodTile.xSize);
             BloodTile currentTile = (BloodTile)Instantiate(bloodTile, new Vector3(xPos, yPos, 1), Quaternion.identity, tileGrid);
             currentTile.x = j;
             currentTile.y = i;
         }
     }
 }