// Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(float delta) { time += delta; var areas = area2D.GetOverlappingAreas(); if (areas.Count <= 0) { return; } foreach (Area2D area in areas) { var batonId = area.GetOwner <Baton>().batonId; if (JsonLogger.GetInstance().Recording) { var detection = new Detection(batonId, BeaconId, (int)(time * 1000)); JsonLogger.GetInstance().LogDetection(detection); var buf = $"{beaconId},{(int)(time*1000)},{batonId},IGNORE\n".ToUTF8(); tcpClient.GetStream().Write(buf, 0, buf.Length); } } }
public void LogDetection(Detection detection) { detections.Add(detection); }