void Update() { newPosition = transform.position.x; if (newPosition - actualPosition >= 1) { PlatformerStats.AddScore(distanceScore); actualPosition = newPosition; } }
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(); }