Exemple #1
0
    public Vector3 GetRandomPoint(T obj)
    {
        int x, y;

        x = Random.Range(0, 10);
        y = Random.Range(0, 6);
        AreaNode <T> node = nodes[x, y];

        if (node.IsFree)
        {
            node.AssignObject(obj);
            return(node.NodePosition);
        }
        else
        {
            return(GetRandomPoint(obj, x + 1, y + 1));
        }
    }
Exemple #2
0
    private Vector3 GetRandomPoint(T obj, int x, int y)
    {
        if (y > 5)
        {
            x++;
            y = 0;
        }
        if (x > 9)
        {
            x = 0;
        }
        AreaNode <T> node = nodes[x, y];

        if (node.IsFree)
        {
            node.AssignObject(obj);
            return(node.NodePosition);
        }
        else
        {
            return(GetRandomPoint(obj, x + 1, y + 1));
        }
    }