Example #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         collision.gameObject.GetComponent <PlayerMovement>().enabled = false;
         collision.transform.localScale = new Vector3(collision.transform.localScale.x, collision.transform.localScale.y - 0.05f, collision.transform.localScale.z);
         if (collision.transform.localScale.y < 0.1f)
         {
             PlayerLife_Planta.PlayerDeath();
         }
     }
 }
Example #2
0
    private void Update()
    {
        if (isDissolving)
        {
            fade -= 0.5f * Time.deltaTime;

            if (fade <= 0f)
            {
                fade         = 0f;
                isDissolving = false;
                PlayerLife_Planta.PlayerDeath();
            }

            // Set the property
            dissolve.SetFloat("_Fade", fade);
            flor.material.SetFloat("_Fade", fade);
        }
    }