DebugCanvas and ShootDebug

Fixed DebugAmmunitionText on DebugCanvas
Added hitForce on Weapons. When you hit an object with a rigidbody its going to fly back a little bit
This commit is contained in:
Noah4ever
2021-12-10 15:38:59 +01:00
parent 14a8f084d3
commit 9512d9dac1
5 changed files with 35 additions and 9 deletions

View File

@@ -9,11 +9,14 @@ public class DebugCanvas : MonoBehaviour
{
public TextMeshProUGUI DebugTextGrounded;
public TextMeshProUGUI DebugTextClientServer;
public TextMeshProUGUI DebugAmmunition;
public GameObject Player;
public GameObject GameManager;
public TextMeshProUGUI fpsText;
public float deltaTime;
private Shoot shoot;
private void Start()
{
GameManager = GameObject.Find("GameManager");
@@ -26,6 +29,7 @@ public class DebugCanvas : MonoBehaviour
try
{
Player = GameObject.FindGameObjectWithTag("Player").gameObject;
shoot = Player.GetComponent<Shoot>();
Debug.Log("Player Found");
}
catch
@@ -37,6 +41,10 @@ public class DebugCanvas : MonoBehaviour
else
{
DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString();
if (Player)
{
DebugAmmunition.text = shoot.CurAmmo + " / " + shoot.TotalAmmo;
}
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";