Ejemplo n.º 1
0
    public void SetNextPoint()
    {
        if (CurrentPath.Count <= 0)
        {
            return;
        }

        Vector2Int nextPoint = CurrentPath.Peek();

        if (CurrentPath.Count == 1 && !TilemapGrid.IsWalkable(nextPoint.x, nextPoint.y))
        {
            _player.Stats.ViewDirection = MoveDirection.FromNextPoint(new Vector2(nextPoint.x, nextPoint.y), _player);

            InvokeCollisionNotification(nextPoint);
            CurrentPath.Dequeue();
            return;
        }
        else
        {
            _character.Components.RealPosition.position = new Vector3(nextPoint.x, nextPoint.y, 0);
            CurrentPath.Dequeue();
        }
    }