Commit 0d55ca20 authored by Maximilian Tomio's avatar Maximilian Tomio
Browse files

Fix Log errors

parent 195d4014
......@@ -9,7 +9,7 @@ public class Clicker : MonoBehaviour
private Logger Logger;
private float LastClickTime = 0;
private float LastClickTimeSeconds = 0;
private int TotalClicks = 0;
private int MissClicks = 0;
......@@ -19,15 +19,17 @@ public class Clicker : MonoBehaviour
Logger = GameObject.Find("Logger").GetComponent<Logger>();
}
public void ResetClickTime()
public void Reset()
{
LastClickTime = 0;
LastClickTimeSeconds = 0;
TotalClicks = 0;
MissClicks = 0;
}
// Update is called once per frame
void Update()
{
LastClickTime += Time.deltaTime;
LastClickTimeSeconds += Time.deltaTime;
if (Input.GetMouseButtonDown(0))
{
......@@ -35,13 +37,13 @@ public class Clicker : MonoBehaviour
if(Physics.Raycast(ray, out RaycastHit hit, 100.0f))
{
if(hit.transform != null && hit.transform.GetComponent<ClickableSphere>() != null && hit.transform.GetComponent<ClickableSphere>() == SphereHandler.CurrentActive)
if (hit.transform != null && hit.transform.GetComponent<ClickableSphere>() != null && hit.transform.GetComponent<ClickableSphere>() == SphereHandler.CurrentActive)
{
TotalClicks++;
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataHit = new ClickDataSet(
LastClickTime,
LastClickTimeSeconds * 1000,
Camera.main.WorldToScreenPoint(hit.point),
Camera.main.WorldToScreenPoint(hit.transform.position),
errorRate,
......@@ -50,28 +52,28 @@ public class Clicker : MonoBehaviour
Logger.AddDataSet(dataHit);
SphereHandler.NextActive();
return;
}
TotalClicks++;
MissClicks++;
var active = SphereHandler.CurrentActive;
if(active != null)
else
{
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataMiss = new ClickDataSet(
LastClickTime,
Input.mousePosition,
Camera.main.WorldToScreenPoint(active.transform.position),
errorRate,
SphereHandler.GetCurrentDensity(),
SphereHandler.GetCurrentSphereNumbers());
TotalClicks++;
MissClicks++;
var active = SphereHandler.CurrentActive;
if (active != null)
{
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataMiss = new ClickDataSet(
LastClickTimeSeconds * 1000,
Input.mousePosition,
Camera.main.WorldToScreenPoint(active.transform.position),
errorRate,
SphereHandler.GetCurrentDensity(),
SphereHandler.GetCurrentSphereNumbers());
Logger.AddDataSet(dataMiss);
Logger.AddDataSet(dataMiss);
}
}
}
LastClickTime = 0;
LastClickTimeSeconds = 0;
}
}
}
......@@ -1295,6 +1295,9 @@ MonoBehaviour:
Max: {x: 7, y: 2, z: 4}
DensityNumbers:
- {x: 6, y: 40}
- {x: 3, y: 20}
- {x: 4, y: 50}
- {x: 2, y: 10}
MaxSphereSwitches: 30
SphereTemplate: {fileID: 316699081740425071, guid: e765bcf0e7e93b348892df145571802b, type: 3}
--- !u!4 &1656067821
......
......@@ -29,7 +29,7 @@ public class TestHandler : MonoBehaviour
return;
}
Clicker.ResetClickTime();
Clicker.Reset();
UI.enabled = false;
UI.gameObject.SetActive(false);
......@@ -41,6 +41,7 @@ public class TestHandler : MonoBehaviour
Logger.SaveData(SphereHandler.Index);
Logger.ClearData();
SphereHandler.NextDifficulty();
Clicker.Reset();
};
SphereHandler.TestFinished += (sender, args) =>
{
......
......@@ -9,7 +9,7 @@ public class Clicker : MonoBehaviour
private Logger Logger;
private float LastClickTime = 0;
private float LastClickTimeSeconds = 0;
private int TotalClicks = 0;
private int MissClicks = 0;
......@@ -19,15 +19,17 @@ public class Clicker : MonoBehaviour
Logger = GameObject.Find("Logger").GetComponent<Logger>();
}
public void ResetClickTime()
public void Reset()
{
LastClickTime = 0;
LastClickTimeSeconds = 0;
TotalClicks = 0;
MissClicks = 0;
}
// Update is called once per frame
void Update()
{
LastClickTime += Time.deltaTime;
LastClickTimeSeconds += Time.deltaTime;
if (Input.GetMouseButtonDown(0))
{
......@@ -41,7 +43,7 @@ public class Clicker : MonoBehaviour
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataHit = new ClickDataSet(
LastClickTime,
LastClickTimeSeconds * 1000,
Camera.main.WorldToScreenPoint(hit.point),
Camera.main.WorldToScreenPoint(hit.transform.position),
errorRate,
......@@ -50,28 +52,28 @@ public class Clicker : MonoBehaviour
Logger.AddDataSet(dataHit);
SphereHandler.NextActive();
return;
}
TotalClicks++;
MissClicks++;
var active = SphereHandler.CurrentActive;
if(active != null)
else
{
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataMiss = new ClickDataSet(
LastClickTime,
Input.mousePosition,
Camera.main.WorldToScreenPoint(active.transform.position),
errorRate,
SphereHandler.DistancePixel,
SphereHandler.AmplitudePixel);
Logger.AddDataSet(dataMiss);
}
TotalClicks++;
MissClicks++;
var active = SphereHandler.CurrentActive;
if (active != null)
{
float errorRate = (float)MissClicks / (float)TotalClicks;
ClickDataSet dataMiss = new ClickDataSet(
LastClickTimeSeconds * 1000,
Input.mousePosition,
Camera.main.WorldToScreenPoint(active.transform.position),
errorRate,
SphereHandler.DistancePixel,
SphereHandler.AmplitudePixel);
Logger.AddDataSet(dataMiss);
}
}
}
LastClickTime = 0;
LastClickTimeSeconds = 0;
}
}
}
......@@ -29,7 +29,7 @@ public class TestHandler : MonoBehaviour
return;
}
Clicker.ResetClickTime();
Clicker.Reset();
UI.enabled = false;
UI.gameObject.SetActive(false);
......@@ -41,6 +41,7 @@ public class TestHandler : MonoBehaviour
Logger.SaveData(SphereHandler.DifficultyIndex);
Logger.ClearData();
SphereHandler.NextDifficulty();
Clicker.Reset();
};
SphereHandler.TestFinished += (sender, args) =>
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment