Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("CheckPoint"))
        {
            if (!collision.gameObject.GetComponent <UsedCheckpoint>().used)
            {
                checkPointMaiorAtivado = false;
                initialPoint           = collision.gameObject.transform.position;
                collision.gameObject.GetComponent <UsedCheckpoint>().used = true;
            }
        }

        else if (collision.gameObject.CompareTag("CheckPointMaior"))
        {
            if (!collision.gameObject.GetComponent <UsedCheckpoint>().used)
            {
                collision.gameObject.GetComponent <UsedCheckpoint>().used = true;
                if (!checkPointMaiorAtivado)
                {
                    initialPoint = collision.gameObject.transform.position;
                    PlayerLife_Planta.playerLife = 3;
                    PlayerLife_Planta.UpdateLives();
                    checkPointMaiorAtivado = true;
                }
            }
        }
    }
Example #2
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 #3
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);
        }
    }