예제 #1
0
    void spawn(AnimationCurve probabilityCurve, IEnumerable <Transform> spawnPoints, Action <Transform> spawnRoutine)
    {
        int numberToSpawn = probabilityCurve.GetNumberOfItemsToSpawn();

        var spawnPointList = new List <Transform>(spawnPoints);

        spawnPointList.ShuffleInPlace();

        for (int i = 0; i < numberToSpawn && i < spawnPointList.Count; i++)
        {
            spawnRoutine(spawnPointList[i]);
        }
    }
예제 #2
0
    private void spawnFishingSpots()
    {
        var guaranteedSpot = GuaranteedFishingSpotZone.PickRandom();

        Instantiate(FishingSpotPrefab, guaranteedSpot.position, Quaternion.identity).SpawnLootRow(GuaranteedFishingSpotLoot.GetNext());

        int spotsToSpawn      = FishingSpotsToSpawnProbabilityCurve.GetNumberOfItemsToSpawn();
        var shuffledFishSpots = shuffle(FishingSpotSpawnPoints);

        for (int i = 0; i < spotsToSpawn - 1; i++)
        {
            var t = shuffledFishSpots[i];
            if (t == guaranteedSpot)
            {
                continue;
            }

            Instantiate(FishingSpotPrefab, t.position, Quaternion.identity).SpawnLootRow(OtherFishingSpotLoot.GetNext());
        }
    }