simple UI added

This commit is contained in:
Mausham
2025-12-11 18:20:42 -08:00
parent 60e58082ac
commit 2118bb7c36
576 changed files with 126744 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using VContainer;
public class Player : MonoBehaviour, IPlayer
{
@@ -6,6 +7,10 @@ public class Player : MonoBehaviour, IPlayer
public Rigidbody BallRb;
public bool isDead { get; private set; }
[Inject] ScoreService scoreService;
[Inject] InputReader inputReader;
[Inject] DeathScreenController deathScreenController;
void Start()
{
if (BallRb == null)
@@ -16,7 +21,7 @@ public class Player : MonoBehaviour, IPlayer
void OnCollisionEnter(Collision collision)
{
if (collision.collider.CompareTag("Platform"))
if (collision.collider.CompareTag("Platform") && !isDead)
{
BallRb.linearVelocity = new Vector3(0, jumpforce, 0);
}
@@ -30,5 +35,15 @@ public class Player : MonoBehaviour, IPlayer
{
Debug.Log("Player is Dead");
isDead = true;
deathScreenController.ShowDeathScreen(scoreService.score,scoreService.GetHighscore());
}
private void OnTriggerEnter(Collider other)
{
if(other.CompareTag("ScoreTrigger"))
{
scoreService.AddScore();
}
}
}