Files
defrain-shooter-unity/Assets/Scripts/DebugCanvas.cs
Noah4ever a2ac91bf6e Camera Shake, WeaponSwitch Animation
Added camera shake. Its not working.. i dont know why.
WeaponSwitch is also not working
2021-12-12 18:19:36 +01:00

49 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Mirror;
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");
}
private void Update()
{
if(Player == null) {
try {
Player = GameObject.FindGameObjectWithTag("Player").gameObject;
shoot = Player.GetComponent<Shoot>();
Debug.Log("Player Found");
}
catch {
//Debug.Log("DEBUG CANVAS PLAYER NOT YET FOUND");
}
} else {
DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString();
if (Player) {
DebugAmmunition.text = shoot.CurAmmo.ToString() + " / " + shoot.TotalAmmo.ToString();
}
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
float fps = 1.0f / deltaTime;
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";
}
}
}