Exemplo n.º 1
0
    private void CreateFog(EnemiesDataManager.EvilFogGenerationData p_data)
    {
        GameObject fog = Instantiate(m_prefabFog,
                                     GenerateMap.PolarToCartesian(GenerateMap.GenerateRandomPolarCoordinates(SettingsManager.Inst.m_rayonExternalSphere, SettingsManager.Inst.m_rayonExternalSphere)),
                                     Quaternion.identity);

        fog.GetComponent <EvilFog>().m_availableEnemies.Clear();
        foreach (int index in p_data.m_availableEnemies)
        {
            fog.GetComponent <EvilFog>().m_availableEnemies.Add(m_availableEnemies[index]);
        }
        fog.GetComponent <EvilFog>().m_numberOfEnemies = p_data.m_numberOfEnemies;
    }
Exemplo n.º 2
0
    /********  OUR MESSAGES     ************************/

    /********  PUBLIC           ************************/

    /********  PROTECTED        ************************/

    /********  PRIVATE          ************************/

    private void CreateAnEnemy()
    {
        int     index            = Random.Range(0, m_availableEnemies.Count - 1);
        Vector3 relativePosition = GenerateMap.PolarToCartesian(GenerateMap.GenerateRandomPolarCoordinates(0, m_data.m_radius));

        // generate enemy
        GameObject enemy = Instantiate(m_availableEnemies[index]);

        enemy.transform.position = transform.position + relativePosition;

        m_numberOfEnemies--;

        if (m_numberOfEnemies <= 0)
        {
            Destroy(gameObject);
        }
    }