Procházet zdrojové kódy

Start and Finish events

Marcel před 3 roky
rodič
revize
5aa8dfb413

+ 23 - 57
.idea/.idea.VRCyling/.idea/workspace.xml

@@ -22,54 +22,11 @@
     <select />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="HMD logging">
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base.meta" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data.meta" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/FrontWheelTrackerLogger.cs" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/FrontWheelTrackerLogger.cs.meta" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Events.meta" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/contentModel.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/indexLayout.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/indexLayout.xml" afterDir="false" />
+    <list default="true" id="ae9d46da-fd77-45ea-9287-d8d155f44bcf" name="Default Changelist" comment="More logging">
       <change beforePath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.VRCyling/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assembly-CSharp-Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Assembly-CSharp-Editor.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assembly-CSharp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Assembly-CSharp.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Helpers.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Helpers.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/AsyncLogFileWriter.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/AsyncLogFileWriter.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/AsyncLogFileWriter.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/AsyncLogFileWriter.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/BikeGameObjectDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/BikeGameObjectDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/BikeGameObjectDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/BikeGameObjectDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/BikeSensorDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/BikeSensorDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/BikeSensorDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/BikeSensorDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/FileLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/FileLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/FileLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/FileLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/ISerializable.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/ISerializable.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/ISerializable.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/ISerializable.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Logable.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/ILogable.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Logable.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/ILogable.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Logging.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/Logging.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Logging.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/Logging.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/PolarAccDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/PolarAccDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/PolarAccDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/PolarAccDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/PolarEcgDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/PolarEcgDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/PolarEcgDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/PolarEcgDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/SensorDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/SensorDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/SensorDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/SensorDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/TimeSync.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/TimeSync.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/TimeSync.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Base/TimeSync.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/ViveSensorDataLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/ViveSensorDataLogger.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/ViveSensorDataLogger.cs.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Data/ViveSensorDataLogger.cs.meta" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Plotting/DebugPlot.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Plotting/DebugPlot.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Routes/Turn.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Routes/Turn.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Tracking/FrontWheelTracker.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Tracking/FrontWheelTracker.cs" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Editor.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Input_Editor.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Input_Editor.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/SteamVR_Windows_EditorHelper.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/SteamVR_Windows_EditorHelper.csproj" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp-Editor.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp-Editor.csprojAssemblyReference.cache" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/Assembly-CSharp.csprojAssemblyReference.cache" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/obj/Debug/SteamVR_Windows_EditorHelper.csprojAssemblyReference.cache" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Scenes/MainScene.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scenes/MainScene.unity" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -90,7 +47,6 @@
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/Assets/Editor/KineticLegTrackerEditor.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Tracking/KineticLegTracker.cs" />
         <option value="$PROJECT_DIR$/Assets/Editor/CalibratableTrackerEditor.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Display/ViveTrackerDebugDisplay.cs" />
@@ -140,6 +96,7 @@
         <option value="$PROJECT_DIR$/Assets/Scripts/Logging/Base/Logging.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Logging/Base/TimeSync.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Routes/Turn.cs" />
+        <option value="$PROJECT_DIR$/Assets/Scripts/Roads/StraightRoadExtras.cs" />
         <option value="$PROJECT_DIR$/Assets/Scripts/Logging/Events/RouteEventLogger.cs" />
       </list>
     </option>
@@ -202,7 +159,7 @@
       <workItem from="1608626823380" duration="6475000" />
       <workItem from="1608633384360" duration="3597000" />
       <workItem from="1609928644105" duration="6587000" />
-      <workItem from="1610355346577" duration="5614000" />
+      <workItem from="1610355346577" duration="6369000" />
     </task>
     <task id="LOCAL-00001" summary="VR Stuff, Bicycle Animations">
       <created>1606399745852</created>
@@ -260,7 +217,14 @@
       <option name="project" value="LOCAL" />
       <updated>1608628621383</updated>
     </task>
-    <option name="localTasksCounter" value="9" />
+    <task id="LOCAL-00009" summary="More logging">
+      <created>1610361817557</created>
+      <option name="number" value="00009" />
+      <option name="presentableId" value="LOCAL-00009" />
+      <option name="project" value="LOCAL" />
+      <updated>1610361817557</updated>
+    </task>
+    <option name="localTasksCounter" value="10" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -290,7 +254,8 @@
     <MESSAGE value="Test Vive Tracker on back" />
     <MESSAGE value="Proper steering calculation" />
     <MESSAGE value="HMD logging" />
-    <option name="LAST_COMMIT_MESSAGE" value="HMD logging" />
+    <MESSAGE value="More logging" />
+    <option name="LAST_COMMIT_MESSAGE" value="More logging" />
   </component>
   <component name="WindowStateProjectService">
     <state x="188" y="243" key="#xdebugger.evaluate" timestamp="1608637186447">
@@ -415,9 +380,10 @@
     <state x="69" y="76" width="1302" height="708" key="VCS.FileHistoryDialog/0.0.1440.860@0.0.1440.860" timestamp="1610361149716" />
     <state x="69" y="80" width="1302" height="741" key="VCS.FileHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1608635342446" />
     <state x="92" y="92" width="1736" height="856" key="VCS.FileHistoryDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1607591027227" />
-    <state x="414" y="218" key="Vcs.Push.Dialog.v2" timestamp="1608628624093">
-      <screen x="0" y="0" width="1440" height="900" />
+    <state x="414" y="208" key="Vcs.Push.Dialog.v2" timestamp="1610361819306">
+      <screen x="0" y="0" width="1440" height="860" />
     </state>
+    <state x="414" y="208" key="Vcs.Push.Dialog.v2/0.0.1440.860@0.0.1440.860" timestamp="1610361819306" />
     <state x="414" y="218" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1608628624093" />
     <state x="552" y="252" key="Vcs.Push.Dialog.v2/0.0.1920.1040@0.0.1920.1040" timestamp="1607593425704" />
     <state width="726" height="436" key="XDebugger.FullValuePopup" timestamp="1608570184149">
@@ -432,10 +398,10 @@
       <screen x="0" y="0" width="1440" height="900" />
     </state>
     <state x="93" y="93" width="1253" height="713" key="com.intellij.history.integration.ui.views.SelectionHistoryDialog/0.0.1440.900@0.0.1440.900" timestamp="1608633349176" />
-    <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1610359567693">
+    <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1610362264361">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1440.860@0.0.1440.860" timestamp="1610359567693" />
+    <state x="332" y="41" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/0.0.1440.860@0.0.1440.860" timestamp="1610362264361" />
     <state x="300" y="85" width="1140" height="689" key="editAsTableFormatDialogDimension" timestamp="1610361477789">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
@@ -444,10 +410,10 @@
       <screen x="0" y="0" width="1440" height="860" />
     </state>
     <state x="368" y="29" width="703" height="801" key="find.popup/0.0.1440.860@0.0.1440.860" timestamp="1610358088077" />
-    <state x="476" y="195" width="672" height="561" key="search.everywhere.popup" timestamp="1610359152935">
+    <state x="478" y="197" width="672" height="561" key="search.everywhere.popup" timestamp="1610362007792">
       <screen x="0" y="0" width="1440" height="860" />
     </state>
-    <state x="476" y="195" width="672" height="561" key="search.everywhere.popup/0.0.1440.860@0.0.1440.860" timestamp="1610359152935" />
+    <state x="478" y="197" width="672" height="561" key="search.everywhere.popup/0.0.1440.860@0.0.1440.860" timestamp="1610362007792" />
     <state x="476" y="204" width="672" height="588" key="search.everywhere.popup/0.0.1440.900@0.0.1440.900" timestamp="1608636877159" />
     <state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1609928849106" />
   </component>

+ 20 - 5
Assets/Scripts/Logging/Events/RouteEventLogger.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using JetBrains.Annotations;
 using Logging.Base;
 using Logging.Data;
+using Roads;
 using Routes;
 using UnityEngine;
 
@@ -14,7 +15,9 @@ namespace Logging.Events
         None,
         Left,
         Right,
-        Straight
+        Straight,
+        Start,
+        Finish
     }
 
     public readonly struct RouteEventData : ISerializable
@@ -43,6 +46,9 @@ namespace Logging.Events
         private bool activeRouteAvailable;
         private IEnumerable<Turn> turns;
 
+        private StraightRoadExtras start;
+        private StraightRoadExtras finish;
+
         public override void Start()
         {
             base.Start();
@@ -50,16 +56,25 @@ namespace Logging.Events
             if (activeRoute == null) return;
 
             activeRouteAvailable = true;
+            start = activeRoute.start;
+            finish = activeRoute.finish;
             turns = activeRoute.items.Select(item => item.turn);
         }
 
         private void Update()
         {
-            var e = activeRouteAvailable ? EventForActiveRoute() : RouteEvent.None;
-            /*if (e != RouteEvent.None)
+            var e = RouteEvent.None;
+            if (start.ArcState == TriggerState.Inside)
+            {
+                e = RouteEvent.Start;
+            }else if (finish.ArcState == TriggerState.Inside)
             {
-                print($"RouteEvent: {e.ToString()}");
-            }*/
+                e = RouteEvent.Finish;
+            }
+            else if(activeRouteAvailable)
+            {
+                e = EventForActiveRoute();
+            }
 
             Log(new RouteEventData(Helpers.RoundToLong(Time.time * 1000f), e));
         }

+ 11 - 0
Assets/Scripts/Roads/StraightRoadExtras.cs

@@ -1,5 +1,6 @@
 using System;
 using Pools;
+using Routes;
 using UnityEngine;
 
 namespace Roads
@@ -10,6 +11,7 @@ namespace Roads
       private GameObject arc;
 
       private bool hasArc;
+      public TriggerState ArcState { get; private set; } = TriggerState.Outside;
 
       public void ShowArc()
       {
@@ -17,11 +19,20 @@ namespace Roads
          hasArc = arc != null;
       }
 
+      private void OnTriggerEnter(Collider other)
+      {
+         if (hasArc && other.CompareTag("bike"))
+         {
+            ArcState = TriggerState.Inside;
+         }
+      }
+
       private void OnTriggerExit(Collider other)
       {
          if (hasArc && other.CompareTag("bike"))
          {
             Destroy(arc);
+            ArcState = TriggerState.Outside;
          }
       }
    }