Exemple #1
0
    private void SpawnMinionWave()
    {
        //GameObject objectToSpawn = _availableEnemyPrefabs[UnityEngine.Random.Range(0, _availableEnemyPrefabs.Count)];
        WaveManager.WavePredictionAI waveData = WaveManager.GetCurrentWave();
        GameObject objectToSpawn = waveData._aitype._aiObjectReference;
        bool       isEnhanced    = WaveManager.GetChanceOfEnhancedAI();

        int toSpawnCount = _waveSize.Random;

        for (int i = 0; i < toSpawnCount; i++)
        {
            Vector3    spawnPos   = _spawnLocation.position + (Vector3.up * objectToSpawn.transform.localScale.y * 1.1f) * i;
            GameObject waveObject = Instantiate(objectToSpawn, spawnPos, _spawnLocation.rotation);
            Enemy_AI   aiRef      = waveObject.GetComponent <Enemy_AI>();
            if (aiRef == null)
            {
                Debug.LogErrorFormat(waveObject, "Could not find reference to 'AI' script on object {0}", waveObject.name);
                continue;
            }

            aiRef.InitialiseAI(new object[] { spawnPos }, waveData._combatType);

            if (isEnhanced)
            {
                Debug.Log("I am enhancing DA AI");
                aiRef.EnhanceAI();
            }
        }
    }
Exemple #2
0
    private void UpdateWavePredictionSprites()
    {
        for (int i = 0; i < _wavePredictionImages.Count; i++)
        {
            if (i == _wavePredictionImages.Count - 1)
            {
                WaveManager.WavePredictionAI waveAI = WaveManager.GetNextHiddenWave();
                _wavePredictionImages[i].sprite = waveAI._aitype._aiTypeIcon;
                _wavePredictionImages[i].color  = waveAI._combatType.RepresentativeTypeColour;
                return;
            }

            _wavePredictionImages[i].sprite = _wavePredictionImages[i + 1].sprite;
        }
    }