InputObject.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using UnityEngine;
  5. namespace CSVReader
  6. {
  7. public enum EntityType {PERSON, CAR,TRUCK, BIKE}
  8. public class InputObject
  9. {
  10. public int ID;
  11. public double Time;
  12. public Vector3 Pos;
  13. public Vector3 Rot;
  14. public Vector3 HeadRot;
  15. public uint TopColor;
  16. public uint BotColor;
  17. public EntityType Type;
  18. public int SensorID;
  19. public InputObject(int id, double time, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float rotHeadX, float rotHeadY, float rotHeadZ,
  20. uint topColor, uint botColor, EntityType type, int sensorID)
  21. {
  22. this.Time = time;
  23. this.ID = id;
  24. Pos = new Vector3(posX, posY, posZ);
  25. Rot = new Vector3(rotX, rotY, rotZ);
  26. HeadRot = new Vector3(rotHeadX, rotHeadY, rotHeadZ);
  27. this.TopColor = topColor;
  28. this.BotColor = botColor;
  29. this.Type = type;
  30. this.SensorID = sensorID;
  31. }
  32. public override bool Equals(object obj)
  33. {
  34. if (obj is InputObject)
  35. {
  36. InputObject other = obj as InputObject;
  37. bool equal = true;
  38. PropertyInfo[] properties = typeof(InputObject).GetProperties();
  39. foreach (PropertyInfo property in properties)
  40. {
  41. equal = property.GetValue(this).Equals(property.GetValue(other));
  42. }
  43. return equal;
  44. }
  45. else
  46. return false;
  47. }
  48. }
  49. }