//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //	* New Method: Update AI Spawning
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 private void UpdateAISpawning()
 {
     if ((GetEnemyCount() + AI_Spawner.GetSpawnQueueCount()) < m_iTotalEnemiesCount)
     {
         int iSpawnerID = Random.Range(0, m_aAISpawners.Length);
         m_aAISpawners[iSpawnerID].AddToSpawnList((Random.Range(0, 2) == 0 ? m_goLacelingEnemy : Random.Range(0, 2) == 0 ? m_goRomlingEnemy : m_goStooplingEnemy));
     }
 }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject spawnerObj = GameObject.Find("AISpawner");

        if (spawnerObj != null)
        {
            spawner = spawnerObj.GetComponent <AI_Spawner>();
        }
    }
示例#3
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Add AI_Spawner Component
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    void AddAISpawnerComponent()
    {
        AI_Spawner C = gameObject.AddComponent(typeof(AI_Spawner)) as AI_Spawner;

        C.hideFlags = HideFlags.HideInInspector;

        GameObject EnemyParent = GameObject.Find("Enemies");

        if (EnemyParent != null)
        {
            C.m_tSpawnParent = EnemyParent.transform;
        }
    }
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Draw AI Spawner Options
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void DrawAISpawnerOptions()
    {
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("AI Spawner", EditorStyles.boldLabel);

        AI_Spawner pSpawner = Target.gameObject.GetComponent <AI_Spawner>();

        EditorGUILayout.LabelField("Spawn Cooldown Time");
        EditorGUI.indentLevel += 1;
        {
            pSpawner.m_fSpawnCooldownMin = EditorGUILayout.FloatField("Min: ", pSpawner.m_fSpawnCooldownMin);
            pSpawner.m_fSpawnCooldownMax = EditorGUILayout.FloatField("Max: ", pSpawner.m_fSpawnCooldownMax);
        }
        EditorGUI.indentLevel -= 1;

        pSpawner.m_iChanceToSpawnStoopling = EditorGUILayout.IntField("Stoopling Spawn Chance: ", pSpawner.m_iChanceToSpawnStoopling);
        pSpawner.m_iChanceToSpawnLaceling  = EditorGUILayout.IntField("Laceling Spawn Chance: ", pSpawner.m_iChanceToSpawnLaceling);
        pSpawner.m_iChanceToSpawnRomling   = EditorGUILayout.IntField("Romling Spawn Chance: ", pSpawner.m_iChanceToSpawnRomling);

        pSpawner.m_tSpawnParent = EditorGUILayout.ObjectField("Enemy Parent Transform: ", pSpawner.m_tSpawnParent, typeof(Transform), true) as Transform;
    }