Пример #1
0
    private void spawn_mob(Vector2 spawn_location, int size)
    {
        spawn_alien(spawn_location);
        int spawn_count = 1;

        foreach (var location in surrounding_squares(spawn_location))
        {
            if (spawnable.location_spawnable(location))
            {
                spawn_alien(location);
                spawn_count++;
                if (spawn_count >= size)
                {
                    return;
                }
            }
            if (spawnable.location_pathable(location))
            {
                foreach (var child_location in surrounding_squares(location))
                {
                    if (spawnable.location_spawnable(child_location))
                    {
                        spawn_alien(child_location);
                        spawn_count++;
                        if (spawn_count >= size)
                        {
                            return;
                        }
                    }
                }
            }
        }
    }