Hide objects in front of player

This commit is contained in:
Vladimir Koshevarov
2022-11-17 19:20:24 +02:00
parent ed1c16db33
commit be23c9fa96
4 changed files with 183 additions and 102 deletions
+4 -3
View File
@@ -9,7 +9,7 @@ public class PlayerManager : MonoBehaviour
public Stat money = new Stat("Money", 100.0f);
public Stat rentAccount = new Stat("Rent Account", 0);
public Stat food = new Stat("Food Energy", 100);
public Stat energy = new Stat("Energy", 12);
public Stat energy = new Stat("Energy", 100);
// bank
public Stat bankAccount = new Stat("Bank Account", 0);
@@ -73,12 +73,13 @@ public class PlayerManager : MonoBehaviour
if (Input.GetMouseButton(0))
{
Ray myRay = playerCamera.ScreenPointToRay(Input.mousePosition);
targetDest.Stop();
if (Physics.Raycast(myRay, out RaycastHit hit))
{
targetDest.transform.position = hit.point;
targetDest.Play();
player.SetDestination(hit.point);
targetDest.Play();
}
}
}