Beispiel #1
0
    public void SpawnGroup(Vector3 space)
    {
        PlatformGroup pg = GetGroupForSpace(space);

        while (pg.HasFreeSpace())
        {
            GeneratePlatform(pg.GetRandomFreeSpace());
        }
    }
Beispiel #2
0
    private Vector3 GetFreePlatformPosition(List <PlatformGroup> available)
    {
        if (available.Count < 1)
        {
            throw new InvalidOperationException("No free space available!");
        }

        PlatformGroup pg = available[Random.Range(0, available.Count)];

        if (pg.HasFreeSpace())
        {
            return(pg.GetRandomFreeSpace());
        }

        List <PlatformGroup> a = new List <PlatformGroup>();

        a.AddRange(available);
        a.Remove(pg);
        return(GetFreePlatformPosition(a));
    }