Esempio n. 1
0
    public bool Move(Vector2Int destination)
    {
        var newPos =
            Vector2.MoveTowards(
                _rigidbody2D.position,
                destination,
                _villagerModel.Speed * Time.deltaTime);

        _rigidbody2D.MovePosition(newPos);

        if (!BitMath.CloseEnough(_rigidbody2D.position, destination))
        {
            return(false);
        }

        _rigidbody2D.MovePosition(destination);
        return(true);
    }