예제 #1
0
        private void OnTriggerEnter2D(Collider2D col)
        {
#if DEBUG
            Debug.Log(name + " entered trigger " + col.name);
#endif

            if (col.name == "Currency")
            {
                sessionData.CherriesThisRun++;
                CloudVariables.TotalCollectedCherries++;
                sessionData.Cherries++;

                AudioClipPlayer.PlayCherry();

                points.transform.position = col.transform.position;
                points.Play();
                objectPooler.Recycle(col.gameObject);
            }
            else if (col.name.StartsWith("Jump") || col.name.StartsWith("Slide"))
            {
                if (!obstacleCollisionOn)
                {
                    return;
                }

                AudioClipPlayer.PlayDeath();

                deathEffect.transform.position = transform.position;
                deathEffect.Play();
                gameManager.PlayerDeath();
            }
        }