Пример #1
0
    private void kill()
    {
        //Add money
        UpgradeManager.money += cashValue;

        // plays sound
        string[] twoOptions = new string[2] {
            "voice_female_a_hurt_pain_01", "voice_female_b_hurt_pain_07"
        };
        AudioClip audio = Resources.Load <AudioClip>(twoOptions[Random.Range(0, 2)]);

        this.GetComponent <AudioSource>().PlayOneShot(audio);

        //Disable movement
        //Disable attacks
        //Death animation
        animator.enabled = false;
        alive            = false;

        //Disable trigger boxes
        GetComponent <Collider2D>().enabled = false;
        spawnManager.enemyDie(gameObject);
    }