Exemple #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform.CompareTag("Player"))
        {
            collectedcheckPoint  = saveGame.CollectSavedValues();
            collectedcheckPoint += 1;

            Debug.Log("The checkpoint was saved now: " + collectedcheckPoint);

            SaveLoadGame.SaveCheckpoint(collectedcheckPoint);
            if (collision.transform.GetComponent <playerHealth>() == true)
            {
                collision.transform.GetComponent <playerHealth>().TakeDamage(-1);
                Instantiate(HealParticles, transform.position, Quaternion.identity);
                Destroy(this.gameObject);
            }
        }
    }