public s_collider CheckSpace(int x, int y) { s_collider sCol = new s_collider(); Collider[] collider = Physics.OverlapSphere(new Vector3(x, y), 0.5f); foreach (Collider c in collider) { if (c.tag == "Stone" || c.tag == "Heart" || c.tag == "Bomb" || c.tag == "Player") { sCol._col = true; sCol._collider = c.transform; if (c.tag != "Player") { sCol.type = 5; } else { sCol.type = 8; } return(sCol); } } if (LevelGrid.CheckTile(x, y)) { if (x >= 0 && x < LevelGrid.ld.gridSizeX - 1 && y >= 0 && y < LevelGrid.ld.gridSizeY - 1) { if (LevelGrid.ld.tileData[x, y].tileType == 2) { sCol.type = 2; } else if (LevelGrid.ld.tileData[x, y].tileType == 1) { sCol.type = 1; } } sCol._col = true; sCol._collider = null; return(sCol); } else { sCol._col = false; sCol._collider = null; } //Debug.Log("No Collision!"); return(sCol); }