simple UI added
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user