first push!

This commit is contained in:
2026-02-20 17:53:43 +01:00
parent ab073a6a39
commit e723ab86b9
274 changed files with 89671 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
public class ForceCurveDataLogger : MonoBehaviour
{
private List<float> _strokeBuffer = new List<float>();
void Start()
{
if (PerformanceMonitorManager.Instance != null)
PerformanceMonitorManager.Instance.OnForceCurveUpdated += HandleData;
}
void HandleData(List<float> points)
{
// 1. SIGNAL: Manager sends empty list when a NEW stroke starts
if (points.Count == 0)
{
if (_strokeBuffer.Count > 5)
{
LogFinishedStroke();
}
_strokeBuffer.Clear();
}
else
{
// 2. Accumulate the cumulative data
_strokeBuffer = new List<float>(points);
}
}
void LogFinishedStroke()
{
float maxForce = _strokeBuffer.Max();
float totalImpulse = _strokeBuffer.Sum(); // Area under the curve
string csv = string.Join(",", _strokeBuffer.Select(p => p.ToString("0")));
Debug.Log($"<color=#FF7F00><b>[STROKE RECORDED]</b></color> Impulse: {totalImpulse:N0} | Pts: {_strokeBuffer.Count} | Max: {maxForce}");
Debug.Log("CSV:" + csv);
}
}