Ejemplo n.º 1
0
 void Update()
 {
     if (gameObject.transform.childCount > 0)
     {
         c.g -= Time.deltaTime * timescale;
         r.materials[0].color = c;
         if (c.g < 0.1f)
         {
             SoundManager manager = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent <SoundManager>();
             manager.PlaySound(AudioEnum.Boom);
             Instantiate(boomeffect, gameObject.transform.position, Quaternion.identity);
             gameObject.transform.GetChild(0).SetParent(null);
             bonus_to_params = GameObject.FindGameObjectWithTag("LevelParams").GetComponent <LevelParams>();
             bonus_to_params.Damage(damagevalue);
         }
     }
     else if (c.g < 1)
     {
         c.g += Time.deltaTime * timescale;
         r.materials[0].color = c;
     }
 }
Ejemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            if (isEvil)
            {
                SoundManager managers = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent <SoundManager>();
                managers.PlaySound(AudioEnum.Boom);
                Instantiate(boomeffect, gameObject.transform.position, Quaternion.identity);
                bonus_to_params.Damage(bonus_value);
            }
            else
            {
                SoundManager manager = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent <SoundManager>();
                manager.PlaySound(AudioEnum.Bonus);
                bonus_to_params.GetBonus();
                if (transform.root == null)
                {
                    Instantiate(sparks, transform.position, Quaternion.identity);
                }
                else
                {
                    Instantiate(sparks, transform.localPosition, Quaternion.identity);
                }
            }



            Debug.Log("Collect!");
            if (bonus_to_params.bonuslist.Contains(this.gameObject))
            {
                bonus_to_params.bonuslist.Remove(this.gameObject);
            }
            Destroy(gameObject);
        }
    }
Ejemplo n.º 3
0
 public void SetHPTo0()
 {
     Lparams.Damage(999);
 }