| | |
| | | } |
| | | public void CharacterDrill(ContactPoint2D contact, DrillDirection drillDirection) |
| | | { |
| | | Vector3Int cellCoord = tilemap.transform.GetComponentInParent<GridLayout>().WorldToCell(contact.point); |
| | | switch(drillDirection) |
| | | GridLayout grid = tilemap.transform.GetComponentInParent<GridLayout>(); |
| | | Vector3Int cellCoord = grid.WorldToCell(contact.point); |
| | | switch (drillDirection) |
| | | { |
| | | case DrillDirection.Left: |
| | | cellCoord.x = cellCoord.x - 1; |
| | |
| | | cellCoord.y = cellCoord.y - 1; |
| | | break; |
| | | } |
| | | tilemap.SetTile(cellCoord, null); |
| | | |
| | | //Debug.Log("cellCoord: " + grid.CellToWorld(cellCoord)); |
| | | //Debug.Log(tilemap.HasTile(cellCoord)); |
| | | if (tilemap.HasTile(cellCoord)) |
| | | { |
| | | tilemap.SetTile(cellCoord, null); |
| | | Vector3 moveToPosition = grid.CellToWorld(cellCoord); |
| | | moveToPosition.x += 0.5f; |
| | | moveToPosition.y += 0.5f; |
| | | CharacterEvents.characterDrillingToPosition.Invoke(moveToPosition); |
| | | } |
| | | } |
| | | public void GameLoaded() |
| | | { |