Added Scoring
added ability to get rid of treats and increment a score
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BasketController : MonoBehaviour
|
||||
{
|
||||
public ScoreManager scoreManager;
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
Debug.Log("2D Solid hit with: " + collision.gameObject.name);
|
||||
|
||||
if (collision.gameObject.CompareTag("Interactable"))
|
||||
{
|
||||
scoreManager.AddPoints(1);
|
||||
|
||||
GameObject.Destroy(collision.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user