Ejemplo n.º 1
0
    void Start()
    {
        GameObject playerLegionControlObj = GameObject.FindGameObjectWithTag("Player");

        playerLegionControl = playerLegionControlObj.GetComponent <PlayerLegionControl>();
        InvokeRepeating("SpawnEnemyLegion", 2f, spawnInterval);
    }
Ejemplo n.º 2
0
    void Start()
    {
        legionColor  = Color.Lerp(legionColor, legionColorVariance, Random.Range(0f, 1f));
        mapGenerator = FindObjectOfType <MapGenerator>();

        InitializeSoldiers("Enemy", transform.position);
        InvokeRepeating("SetRandomDestination", 1f, newDestTime);

        GameObject          playerLegionControlObj = GameObject.FindGameObjectWithTag("Player");
        PlayerLegionControl playerLegionControl    = playerLegionControlObj.GetComponent <PlayerLegionControl>();

        for (int i = 0; i < legion.childCount; i++)
        {
            Transform     soldierTransform = legion.GetChild(i);
            SoldierEntity soldierEntity    = soldierTransform.GetComponent <SoldierEntity>();
            soldierEntity.OnSoldierDead += playerLegionControl.OnEnemySoldierDead;
        }
    }