KeepItUp/Assets/_Scripts/PlayerScripts/PlayerCollisions.cs
cuqmbr 9fba37c78a refactor: decouple UI and Score managers logic
Single Responsibility Principle?
2022-07-22 13:50:49 +03:00

20 lines
516 B
C#

using UnityEngine;
public class PlayerCollisions : MonoBehaviour
{
[SerializeField] private ScoreManager _scoreManager;
private void OnCollisionEnter2D(Collision2D coll)
{
switch (coll.gameObject.tag)
{
case "Wall":
PlayerEvents.SendWallTouched();
break;
case "Floor":
PlayerEvents.SendDeath();
GameStateManager.Instance.ChangeState(GameState.GameOver);
break;
}
}
}