Пример #1
0
    public bool Move()
    {
        if (0 == _pathStack.Count)
        {
            return(true);
        }

        bool bIsArrived = (_character.GetTransform().position.x.EqualApproximately(_pathTargetCell.GetPosition().x, 0.2f) &&
                           _character.GetTransform().position.y.EqualApproximately(_pathTargetCell.GetPosition().y, 0.2f));

        if (bIsArrived)
        {
            _pathTargetCell = _pathStack.Pop();
            _direction      = TileHelper.GetDirectionVector(_character.GetCurrentTileCell(), _pathTargetCell);
        }

        Vector2 newPosition = TileHelper.GetSlopeDirection(_direction);

        _character.UpdateDirection(_direction);
        _character.UpdatePosition(newPosition);

        return(false);
    }