public GameObject[] SpawnInstances(SceneScroller.SpawnableInterestInfo[] templates, float spawnChance, int amountMultiplier) { var result = new List<GameObject>(templates.Length); while (result.Count < this.amount * amountMultiplier) { if (UnityEngine.Random.Range(0.0f, 1.0f) > spawnChance) { continue; } var template = WeightedSet<SceneScroller.SpawnableInterestInfo>.SelectRandom(templates); result.Add(this.SpawnInstance(template.spawnableInterest)); } return result.ToArray(); }
protected SceneGroupInstanceInfo GetNextSceneGroupInstanceInfo() { SceneGroupInstanceInfo result = new SceneGroupInstanceInfo(); if (this.overrideSceneGroupInfo.sceneGroup != null) { result.group = this.overrideSceneGroupInfo; } else { result.group = WeightedSet <SceneGroupInfo> .SelectRandom(this.sceneGroupInfos); } var instanceCount = result.group.sceneInstanceCount; result.remainingInstanceCount = instanceCount.GetRandomValue(); return(result); }