EventObject.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace CSVReader
  5. {
  6. public enum EventType { CARCRASH, FALLINGPERSON, CONFETTICANNON, EXPLOSION }
  7. public class EventObject
  8. {
  9. public int ID;
  10. public double TimestampStart;
  11. public double TimestampEnd = -1;
  12. public Vector3 Pos;
  13. public Vector3 IdealViewingPos;
  14. public bool IdealViewingPosSet = false;
  15. public EventType Type;
  16. public EventObject(int id, double startingtime, float posX, float posY, float posZ, EventType type)
  17. {
  18. this.ID = id;
  19. this.TimestampStart = startingtime;
  20. this.Pos = new Vector3(posX, posY, posZ);
  21. this.Type = type;
  22. }
  23. public void setIdealViewingPosition(float posX, float posY, float posZ)
  24. {
  25. this.IdealViewingPos = new Vector3(posX, posY, posZ);
  26. IdealViewingPosSet = true;
  27. }
  28. public bool Equals(EventObject comEve)
  29. {
  30. if (this.IdealViewingPos == null)
  31. {
  32. if (comEve.IdealViewingPos == null)
  33. {
  34. return this.ID == comEve.ID && this.TimestampStart == comEve.TimestampStart && this.TimestampEnd == comEve.TimestampEnd &&
  35. this.Pos.x == comEve.Pos.x && this.Pos.y == comEve.Pos.y && this.Pos.z == comEve.Pos.z && this.Type == comEve.Type;
  36. }
  37. else
  38. {
  39. return false;
  40. }
  41. }
  42. return this.ID == comEve.ID && this.TimestampStart == comEve.TimestampStart && this.TimestampEnd == comEve.TimestampEnd &&
  43. this.Pos.x == comEve.Pos.x && this.Pos.y == comEve.Pos.y && this.Pos.z == comEve.Pos.z && this.Type == comEve.Type &&
  44. this.IdealViewingPos.x == comEve.IdealViewingPos.x && this.IdealViewingPos.y == comEve.IdealViewingPos.y &&
  45. this.IdealViewingPos.z == comEve.IdealViewingPos.z;
  46. }
  47. }
  48. }