|
@@ -18,9 +18,10 @@ namespace Logging.Data
|
|
|
private readonly float velocityX;
|
|
|
private readonly float velocityY;
|
|
|
private readonly float velocityZ;
|
|
|
+ private readonly int collisionCounter;
|
|
|
|
|
|
public BikeGameObjectDataLog(long timestamp, float positionX, float positionY, float positionZ, float rotationX,
|
|
|
- float rotationY, float rotationZ, float velocityX, float velocityY, float velocityZ)
|
|
|
+ float rotationY, float rotationZ, float velocityX, float velocityY, float velocityZ, int collisionCounter)
|
|
|
{
|
|
|
this.timestamp = timestamp;
|
|
|
this.positionX = positionX;
|
|
@@ -32,6 +33,7 @@ namespace Logging.Data
|
|
|
this.velocityX = velocityX;
|
|
|
this.velocityY = velocityY;
|
|
|
this.velocityZ = velocityZ;
|
|
|
+ this.collisionCounter = collisionCounter;
|
|
|
}
|
|
|
|
|
|
public KeyValuePair<long, string[]> Serialize()
|
|
@@ -47,7 +49,8 @@ namespace Logging.Data
|
|
|
rotationZ.ToString("F6", CultureInfo.InvariantCulture),
|
|
|
velocityX.ToString("F6", CultureInfo.InvariantCulture),
|
|
|
velocityY.ToString("F6", CultureInfo.InvariantCulture),
|
|
|
- velocityZ.ToString("F6", CultureInfo.InvariantCulture)
|
|
|
+ velocityZ.ToString("F6", CultureInfo.InvariantCulture),
|
|
|
+ collisionCounter.ToString("F6", CultureInfo.InvariantCulture)
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -57,11 +60,14 @@ namespace Logging.Data
|
|
|
public Rigidbody bike;
|
|
|
private Transform bikeTransform;
|
|
|
public override string Key => "bike_game_object_data";
|
|
|
+ public GameObject bikePlayer;
|
|
|
|
|
|
public override void Start()
|
|
|
{
|
|
|
base.Start();
|
|
|
bikeTransform = bike.transform;
|
|
|
+ // TODO: This is a bit crude
|
|
|
+ bikePlayer = GameObject.Find("bike");
|
|
|
}
|
|
|
|
|
|
private void Update()
|
|
@@ -69,11 +75,12 @@ namespace Logging.Data
|
|
|
var pos = bikeTransform.position;
|
|
|
var rot = bikeTransform.rotation.eulerAngles;
|
|
|
var velocity = bike.velocity;
|
|
|
+ var playerStats = bikePlayer.GetComponent<PlayerStats>();
|
|
|
|
|
|
Log(new BikeGameObjectDataLog(Helpers.RoundToLong(Time.time * 1000),
|
|
|
pos.x, pos.y, pos.z,
|
|
|
rot.x, rot.y, rot.z,
|
|
|
- velocity.x, velocity.y, velocity.z));
|
|
|
+ velocity.x, velocity.y, velocity.z, playerStats.collisionCounter));
|
|
|
}
|
|
|
|
|
|
public override IEnumerable<BikeGameObjectDataLog> ReadLog(IEnumerable<IEnumerable<string>> lines)
|
|
@@ -81,4 +88,4 @@ namespace Logging.Data
|
|
|
throw new NotImplementedException(); //TODO
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|