You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class MouseRecordData
{
public List<float> TimeList;
public List<Vector2> PosList;
public List<int> StateList;
public float startTime;
public int currentCount;
public MouseRecordData(MouseRecordData rec)
{
TimeList = rec.TimeList;
PosList = rec.PosList;
StateList = rec.StateList;
}
public MouseRecordData()
{
TimeList = new List<float>();
PosList = new List<Vector2>();
StateList = new List<int>();
}
public void StartUse()
{
startTime = Time.time;
currentCount = 1;
}
public float CurrentTimeInterval { get { return TimeList[currentCount]; } }
public Vector2 CurrentPosition { get { return PosList[currentCount]; } }
public int CurrentState { get { return StateList[currentCount]; } }
public void AddData(float time, Vector2 pos, int state)
{
TimeList.Add(time);
PosList.Add(new Vector2(pos.x / Screen.width, (Screen.height - pos.y) / Screen.height));
StateList.Add(state);
}
public void RemoveData(int i)
{
TimeList.RemoveAt(i);
PosList.RemoveAt(i);
StateList.RemoveAt(i);
}
}