/* need to implement generalised functions to cut down the following but cbf atm lol */ public Vector3 Position(int i) { if (data.Count() <= i) { throw new IndexOutOfRangeException(); } Addr.PodState xOff = Addr.PodState.X, yOff = Addr.PodState.Y, zOff = Addr.PodState.Z; int xI = data[i].ValueExists(DataCollection.DataBlock.Path.PodState, (uint)xOff, Addr.GetLength(xOff)); int yI = data[i].ValueExists(DataCollection.DataBlock.Path.PodState, (uint)yOff, Addr.GetLength(yOff)); int zI = data[i].ValueExists(DataCollection.DataBlock.Path.PodState, (uint)zOff, Addr.GetLength(zOff)); if (!(xI >= 0 && yI >= 0 && zI >= 0)) { throw new Exception("Position not found in data set."); } float X = data[i].data[xI].GetValue((uint)xOff, Addr.GetType(xOff)); float Y = data[i].data[yI].GetValue((uint)yOff, Addr.GetType(yOff)); float Z = data[i].data[zI].GetValue((uint)zOff, Addr.GetType(zOff)); return(new Vector3(X, Y, Z)); }
// POD STATE public dynamic GetData(Addr.PodState datapoint, uint len = 0) { uint[] path = { (uint)Addr.BasePtr.Pod, (uint)Addr.Pod.PtrPodState, (uint)datapoint }; Core.DataType type = len > 0 ? Core.DataType.None : Addr.GetType(datapoint); return(GetData(path, type, Math.Max(0, len))); }
// STATIC public dynamic GetData(Addr.Static datapoint, uint len = 0) { uint[] path = { (uint)datapoint }; Core.DataType type = len > 0 ? Core.DataType.None : Addr.GetType(datapoint); return(GetData(path, type, Math.Max(0, len))); }
public dynamic GetValue(Racer racer, Addr.Static datapoint) { return(GetValue(racer, DataBlock.Path.Static, (uint)datapoint, Addr.GetType(datapoint), Addr.GetLength(datapoint))); }