TestLogTrigger.cs 866 B

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEngine;
  2. namespace SchoenLogger.Sample
  3. {
  4. public class TestLogTrigger : MonoBehaviour
  5. {
  6. public Logger<SampleLogEntry, SampleCondition> Logger;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. }
  11. // Update is called once per frame
  12. void Update()
  13. {
  14. }
  15. private void OnTriggerEnter(Collider other)
  16. {
  17. if (Logger == null)
  18. return;
  19. SampleLogEntry entry = new SampleLogEntry();
  20. entry.Time = Time.time;
  21. Vector3 point = other.ClosestPoint(this.transform.position);
  22. entry.EntryPointX = point.x * 20000;
  23. entry.EntryPointY = point.y / 20000;
  24. entry.EntryPointZ = point.z;
  25. Logger.Log(entry);
  26. }
  27. }
  28. }