Beispiel #1
0
    //death animation function
    void Die()
    {
        dead = true;
        legAnimator.SetBool("IsDead", true);
        torsoAnimator.SetBool("IsDead", true);
        bothAnimator.SetBool("dead", true);
        isShooting = false;
        Destroy(transform.GetComponent <BoxCollider2D> ());

        var player = GameObject.FindGameObjectWithTag("Player");

        player.GetComponent <Player> ().IncrementXp(experience);
        if (Random.Range(1, 4) == 2)
        {
            Instantiate(bulletBox[Random.Range(0, (bulletBox.Length))], transform.position, transform.rotation);
        }

        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
        behave.incCoins(coinsWhenDie);
        behave.enemiesKilled++;

        if (Application.loadedLevelName == "HordeMode")
        {
            behave.currentHordeKills++;
        }
    }
Beispiel #2
0
    //death animation function
    void Die()
    {
        dead = true;
        legAnimator.SetBool ("IsDead", true);
        torsoAnimator.SetBool ("IsDead", true);
        bothAnimator.SetBool ("dead", true);
        isShooting = false;
        Destroy (transform.GetComponent<BoxCollider2D> ());

        var player = GameObject.FindGameObjectWithTag("Player");
        player.GetComponent<Player> ().IncrementXp (experience);
        if(Random.Range(1,4) == 2){
            Instantiate( bulletBox[Random.Range(0,(bulletBox.Length))],transform.position,transform.rotation);
        }

        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        behave.incCoins (coinsWhenDie);
        behave.enemiesKilled++;

        if(Application.loadedLevelName == "HordeMode"){

            behave.currentHordeKills++;

        }
    }