tilemap.worldtocell
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
public abstract class Character : MonoBehaviour
|
||||
{
|
||||
@@ -13,7 +14,8 @@ public abstract class Character : MonoBehaviour
|
||||
protected GameObject _bonesBack;
|
||||
[SerializeField]
|
||||
protected GameObject _spawnPoint;
|
||||
|
||||
[SerializeField]
|
||||
protected Tilemap _tileMap;
|
||||
|
||||
[SerializeField]
|
||||
private LayerMask _mapLayer;
|
||||
@@ -127,6 +129,8 @@ public abstract class Character : MonoBehaviour
|
||||
|
||||
private MapElementType GetMapElement(Vector2 direction)
|
||||
{
|
||||
var cell=_tileMap.WorldToCell(transform.position);
|
||||
|
||||
Vector2 rayStartPoint;
|
||||
if (direction == Vector2.down)
|
||||
rayStartPoint = new Vector2(_capsuleCollider.bounds.center.x + direction.x / 2, _capsuleCollider.bounds.min.y - 0.1f);
|
||||
|
||||
Reference in New Issue
Block a user