diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 54be26d..dafa56c 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -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);