예제 #1
0
    public virtual void Die()
    {
//ACTIVATES ONLY IF THE ZOMBIE IS THE ELITE
        if (GetComponent <EliteZombieBehavior>())
        {
            if (GetComponent <EliteZombieBehavior>().elite == true)
            {
                EliteZombieBehavior elite = GetComponent <EliteZombieBehavior>();
                switch (elite.type)
                {
                case Elitetype.Health:
                    Instantiate(HealthUPPrefab, this.transform.position, Quaternion.identity); break;

                case Elitetype.Boom:
                    Instantiate(BoomPrefab, this.transform.position, transform.rotation); break;

                case Elitetype.Money:
                    Instantiate(HunnedPrefab, this.transform.position, Quaternion.identity);
                    break;

                case Elitetype.Item:
                    Instantiate(RewardPrefab, this.transform.position, Quaternion.identity);
                    break;

                case Elitetype.Ammo:
                    Instantiate(AmmoPrefab, this.transform.position, Quaternion.identity);
                    break;
                }
            }
            else
            {
                Instantiate(coin, this.transform.position, Quaternion.identity);
            }
        }
        else
        {
            Instantiate(coin, this.transform.position, Quaternion.identity);
        }
        //ACTIVATES EITHER WAY
        if (Player.GetComponent <MoveScript>().PlayerHasCannibalism == true)
        {
            Debug.Log("Player has cannibalism");
            int randomint = Random.Range(0, 100);
            if (randomint > 95)
            {
                if (movescript.HP < movescript.HPcontainers)
                {
                    Debug.Log("Health restored");
                    movescript.ActivateVampirismEffect();
                    //play some cool animation and sound of drinking blood or whatevs
                }
            }
            else
            {
                //do nothing
            }
        }
        Destroy(this.gameObject);
    }
예제 #2
0
    void Start()
    {
        anim       = GetComponent <Animator> ();
        Player     = GameObject.FindGameObjectWithTag("Player").transform;
        src        = GetComponent <AudioSource> ();
        movescript = Player.GetComponent <MoveScript> ();
        if (GetComponent <EliteZombieBehavior>() != null)
        {
            if (GetComponent <EliteZombieBehavior>().elite == true)
            {
                GameObject          elitelight = Instantiate(Resources.Load <GameObject>("Prefabs/EliteParticles/ZombieLight"), transform.position, Quaternion.identity, transform);
                EliteZombieBehavior elite      = GetComponent <EliteZombieBehavior>();
                SpriteRenderer      sr         = GetComponent <SpriteRenderer>();
                switch (elite.type)
                {
                case Elitetype.Health:
                    sr.color = new Color(1f, 0.1933962f, 0.1933962f);
                    elitelight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>().color = new Color(1f, 0.1933962f, 0.1933962f);
                    HP += 50;
//add some cool particle effect
                    break;

                case Elitetype.Boom:
                    sr.color = new Color(0.3773585f, 0.3773585f, 0.3773585f);
                    elitelight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>().color = new Color(0.3773585f, 0.3773585f, 0.3773585f);
                    GetComponent <AIPath>().maxSpeed += 1;
//add some cool particle effect
                    break;

                case Elitetype.Money:
                    sr.color = new Color(0.6138519f, 1f, 0.495283f);
                    elitelight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>().color = new Color(0.6138519f, 1f, 0.495283f);
                    GetComponent <AIPath>().maxSpeed += 1;
                    HP += 100;
//add some cool particle effect
                    break;

                case Elitetype.Ammo:
                    sr.color = new Color(0.8773585f, 0.4157616f, 0f);
                    elitelight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>().color = new Color(0.8773585f, 0.4157616f, 0f);
                    HP += 100;
                    break;

                case Elitetype.Item:
                    sr.color = new Color(1f, 0.9584457f, 0f);
                    elitelight.GetComponent <UnityEngine.Experimental.Rendering.Universal.Light2D>().color = new Color(1f, 0.9584457f, 0f);
                    HP += 200;
//add some cool particle effect
                    break;
                }
            }
        }
    }