Ejemplo n.º 1
0
        void Awake()
        {
            if (factoryInstance != null)
            {
                Destroy(gameObject);
                return;
            }

            factoryInstance = this;
            DontDestroyOnLoad(gameObject);
        }
Ejemplo n.º 2
0
    private void InitWaveData()
    {
        Factory.AgentFactory af = GameObject.FindWithTag(Constants.FactoryTag).GetComponent <Factory.AgentFactory>();
        amount       = wave.amount;
        interval     = wave.interval;
        minionHealth = wave.health;
        minions      = new GameObject[amount];

        for (int i = 0; i < amount; i++)
        {
            minions[i] = af.CreateMinion(wave.type, Vector3.zero, minionHealth, wave.attackRange);
            minions[i].SetActive(false);
            minions[i].GetComponent <AgentController>().weapon.SetDamage(wave.damage);

            //set health
            HealthController ht = minions[i].transform.Find("HealthController").gameObject.GetComponent <HealthController>();
            ht.Init(wave.health);
        }
    }