DebugController.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using TMPro;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class DebugController : MonoBehaviour
  5. {
  6. public TextMeshProUGUI debugText;
  7. public TextMeshProUGUI statusText;
  8. public GameObject player;
  9. public Terrain terrain;
  10. public RocketDataScript rocketData;
  11. // Start is called once before the first execution of Update after the MonoBehaviour is created
  12. void Start()
  13. {
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. var center = terrain.terrainData.heightmapResolution / 2;
  19. var height = terrain.terrainData.GetHeight(center, center); // * terrain.terrainData.size.y
  20. var rb = player.GetComponent<Rigidbody>();
  21. var collider = player.GetComponent<Collider>();
  22. debugText.text = $"center: {collider.bounds.center}\n" +
  23. $"extents: {collider.bounds.extents}\n" +
  24. $"min: {collider.bounds.min}\n" +
  25. $"terrain height: {height}\n" +
  26. $"player.y: {player.transform.position.y}";
  27. statusText.text = $"fuel: {rocketData.Fuel}\n" +
  28. $"thrustLever: {rocketData.ThrustLever}\n" +
  29. $"velocity: {rb.linearVelocity.y}\n" +
  30. $"mass: {rocketData.Mass}";
  31. }
  32. }