public bool CanMoveFromTo(Player player, Vector3 startPos, Vector3 endPos) { Vector3Int cellStartPos = grid.WorldToCell(startPos); Vector3Int cellEndPos = grid.WorldToCell(endPos); //Verify if the player can move to the target cell //Is it an adjacent cell ? if ((cellStartPos - cellStartPos).magnitude > 1f) { return(false); } //Is it an obstacle ? if (IsObstacle(endPos)) { return(false); } // --- INTERACTABLE //test for obstacles objets (not belonging to tilemap) Interactable interactable = GetInteractable(endPos); //not null if (interactable) { if (!interactable.CanMoveTo(player)) { return(false); } } return(true); }