Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        //gameObject.GetComponentInChildren<SpriteRenderer>().color = new Color(100, 0, 0);
        //gameObject.GetComponent<SpriteRenderer>().color = new Color(health / 100f, health / 100f, 1, 1);
        target      = GameObject.FindWithTag("Player").transform;
        score       = GameObject.FindWithTag("Score").GetComponent <Text>();
        WaveManager = GameObject.Find("ZombieSpawner").GetComponent <waveManager>();

        //health = 100;
        //speed = 5;
    }
    // Use this for initialization
    void Start()
    {
        //totalGold = 0;
        goldRefrence = GameObject.FindWithTag("Player").GetComponent <MoneyBag>();
        target       = goldRefrence.transform;
        score        = GameObject.FindWithTag("Score").GetComponent <Text>();
        WaveManager  = GameObject.Find("ZombieSpawner").GetComponent <waveManager>();

        //health = 100;
        //speed = 5;
    }
Beispiel #3
0
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this);
     }
 }
Beispiel #4
0
    private void Update()
    {
        waveManager WaveManager = Manager.GetComponent <waveManager>();

        if (Object.name == "Zombie")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentZombies < WaveManager.RemainingZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
        else if (Object.name == "MongoZombo")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentMongoZombies < WaveManager.RemainingMongoZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentMongoZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
        else if (Object.name == "FastZombie")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentFastZombies < WaveManager.RemainingFastZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentFastZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
        else if (Object.name == "AngryZombie")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentAngryZombies < WaveManager.RemainingAngryZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentAngryZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
        else if (Object.name == "MongoZombo")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentWumboZombies < WaveManager.RemainingWumboZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentWumboZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
        else if (Object.name == "Wraith")
        {
            if (timeBtwSpawns <= 0 && WaveManager.currentWraithZombies < WaveManager.RemainingWraithZombies)
            {
                //Instantiate(shotEffect, shotPoint.position, Quaternion.identity);
                //camAnim.SetTrigger("shake");
                Instantiate(Object, transform);
                WaveManager.currentWraithZombies++;
                timeBtwSpawns = startTimeBtwSpawns;
            }
            else
            {
                timeBtwSpawns -= Time.deltaTime;
            }
        }
    }
Beispiel #5
0
 IntermissionStarted?.Invoke(waveManager, payload);
Beispiel #6
0
    //public Transform bombPreFab;



    void Start()
    {
        WaveManager = GameObject.Find("ZombieSpawner").GetComponent <waveManager>();
        Invoke("detonate", 2.0f);
    }