protected override void Awake()
    {
        base.Awake();

        var bossWrapper = GetComponentInParent <Boss>();

        head      = bossWrapper.GetComponentInChildren <SpawnHouse>();
        bodyParts = bossWrapper.GetComponentsInChildren <BossPart>();
    }
Beispiel #2
0
        private void HandleSpawning(SpawnHouse building)
        {
            string nameOfNextSpawn = building.GetActions()[RandomUtils.Choose(building.GetProbabilityArray())];

            if (nameOfNextSpawn != null && nameOfNextSpawn != "")
            {
                // TODO: change hardcoded center shift to the one derived from a variable
                var newSpawnPoint = WorkManager.GetRandomDestinationPoint(building.transform.position, 30);

                if (newSpawnPoint.HasValue)
                {
                    building.SetSpawnPoint(newSpawnPoint.Value);
                    building.PerformAction(nameOfNextSpawn);
                }
            }
        }
        private void UpdateSpawnRates(SpawnHouse spawnHouse)
        {
            // adjust spawn interval
            spawnHouse.spawnInterval = Mathf.Min(
                spawnHouse.spawnIntervalUpperLimit,
                Mathf.Max(spawnHouse.spawnIntervalLowerLimit, spawnHouse.spawnInterval + spawnHouse.spawnIntervalAccel * Time.deltaTime)
                );

            // adjust spawn rate of indicatedObject types
            spawnHouse.meleeSwarmlingSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.meleeSwarmlingSpawnRate + spawnHouse.meleeSwarmlingSpawnAccel * Time.deltaTime)
                );
            spawnHouse.rangeSwarmlingSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.rangeSwarmlingSpawnRate + spawnHouse.rangeSwarmlingSpawnAccel * Time.deltaTime)
                );
            spawnHouse.assassinSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.assassinSpawnRate + spawnHouse.assassinSpawnAccel * Time.deltaTime)
                );
            spawnHouse.hulkSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.hulkSpawnRate + spawnHouse.hulkSpawnAccel * Time.deltaTime)
                );
            spawnHouse.damageDealerSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.damageDealerSpawnRate + spawnHouse.damageDealerSpawnAccel * Time.deltaTime)
                );
            spawnHouse.debufferSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.debufferSpawnRate + spawnHouse.debufferSpawnAccel * Time.deltaTime)
                );
            spawnHouse.crowdControlSpawnRate = Mathf.Min(
                spawnHouse.spawnRateUpperLimit,
                Mathf.Max(spawnHouse.spawnRateLowerLimit, spawnHouse.crowdControlSpawnRate + spawnHouse.crowdControlSpawnAccel * Time.deltaTime)
                );
        }