public void Awake()
{
try
{
bool bOnceRestarted = false;
if (System.IO.File.Exists("KMrestart.txt"))
{
bOnceRestarted = true;
try
{
System.IO.File.Delete("KMrestart.txt");
}
catch (Exception ex)
{
Debug.LogError("Error deleting KMrestart.txt");
Debug.LogError(ex.ToString());
}
}
// init the available sensor interfaces
bool bNeedRestart = false;
sensorInterfaces = KinectInterop.InitSensorInterfaces(bOnceRestarted, ref bNeedRestart);
if (bNeedRestart)
{
Debug.Log("Restart kinect");
System.IO.File.WriteAllText("KMrestart.txt", "Restarting level...");
KinectInterop.RestartLevel(gameObject, "KM");
return;
}
else
{
// start the sensor
StartKinect();
}
}
catch (Exception ex)
{
//Debug.LogError(ex.ToString());
if (calibrationText != null)
{
calibrationText.GetComponent<GUIText>().text = ex.Message;
}
}
}