public bool EnterOrLeaveRace(Racer r) { int i = data_prev.ValueExists(Path.Static, (uint)Addr.Static.InRace, Addr.GetLength(Addr.Static.InRace)); bool prev = (i < 0) ? false : data_prev.GetValue(i) > 0; bool now = data.GetValue(r, Addr.Static.InRace) > 0; return(now ^ prev); }
/* 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)); }
public dynamic GetValue(Racer racer, Addr.Static datapoint) { return(GetValue(racer, DataBlock.Path.Static, (uint)datapoint, Addr.GetType(datapoint), Addr.GetLength(datapoint))); }