Exemplo n.º 1
0
    public override void InitPlanet(Transform _enemyPlanets)
    {
        EnemyPlanets = _enemyPlanets;

        //listeEnemyPlanets = new Dictionary<Transform, EnemyPlanet>();
        listPlanetForEveryManager = new Dictionary <Transform, Planet>();
        foreach (Transform enemyPlanet in EnemyPlanets)
        {
            if (enemyPlanet != null)
            {
                EnemyPlanet enemyPlanetComponemt = enemyPlanet.GetComponent <EnemyPlanet>();
                enemyPlanetComponemt.InitPlanet();
                //listeEnemyPlanets.Add(enemyPlanet, enemyPlanetComponemt);
                listPlanetForEveryManager.Add(enemyPlanet, enemyPlanetComponemt);
            }
        }
    }
Exemplo n.º 2
0
    //add new enemy planet to the list
    public override void AddPlanet(Transform positioToAddThePlanet, float maxLevel)
    {
        GameObject enemyPlanet = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs\\Entities\\EnemyPlanet"));

        enemyPlanet.name  = "EnemyPlanet";
        enemyPlanet.tag   = GV.ENEMY_PLANET_TAG;
        enemyPlanet.layer = LayerMask.NameToLayer(GV.ENEMY_PLANET_TAG);
        enemyPlanet.transform.position = positioToAddThePlanet.position;
        enemyPlanet.transform.SetParent(GameObject.FindGameObjectWithTag(GV.PARENT_ENEMY_PLANET).transform);
        EnemyPlanet enemyPlanetComponent = enemyPlanet.GetComponent <EnemyPlanet>();

        if (enemyPlanetComponent == null)
        {
            Debug.LogError("Enemy planet component not attached to the new planet " + enemyPlanet.name);
        }
        else
        {
            enemyPlanetComponent.InitPlanet();
            enemyPlanetComponent.maxLevel = maxLevel;
            listPlanetForEveryManager.Add(enemyPlanet.transform, enemyPlanetComponent);
        }
    }