예제 #1
0
    void Update()
    {
        newPosition = transform.position.x;

        if (newPosition - actualPosition >= 1)
        {
            PlatformerStats.AddScore(distanceScore);
            actualPosition = newPosition;
        }
    }
예제 #2
0
    void OnTriggerEnter2D(Collider2D collider2D)
    {
        if (_isCollected)
        {
            return;
        }

        PlatformerStats.AddScore(ScoreSun);

        if (((1 << collider2D.gameObject.layer) & CollectByLayers.value) != 0)
        {
            _isCollected = true;
            _animation.Play(HideAnimationName);
        }

        GetComponent <AudioSource>().Play();
    }