Add initial game systems and input handling for player interactions
This commit is contained in:
33
Assets/Scripts/Presentation/Present.cs
Normal file
33
Assets/Scripts/Presentation/Present.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Core;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Presentation
|
||||
{
|
||||
public class Present : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int points = 1;
|
||||
|
||||
private PresentSpawner _spawner;
|
||||
|
||||
public void Configure(PresentSpawner spawner)
|
||||
{
|
||||
_spawner = spawner;
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("Ground"))
|
||||
{
|
||||
GameEvents.ReportPresentDropped();
|
||||
_spawner.ReturnToPool(this);
|
||||
}
|
||||
|
||||
if (other.gameObject.CompareTag("Sleigh"))
|
||||
{
|
||||
GameEvents.ReportPresentCaught(points);
|
||||
_spawner.ReturnToPool(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user