Code improvement

This commit is contained in:
Pascal Serrarens 2022-06-03 17:28:19 +02:00
parent 219f2f987c
commit 59f4add2ac
5 changed files with 14 additions and 4 deletions

View File

@ -1082,7 +1082,7 @@ namespace Passer {
using (new EditorGUILayout.HorizontalScope()) { using (new EditorGUILayout.HorizontalScope()) {
EditorGUILayout.LabelField("Tracker", GUILayout.Width(120)); EditorGUILayout.LabelField("Tracker", GUILayout.Width(120));
if (TrackerComponentShowButton()) if (TrackerComponentShowButton())
tracker.CheckTracker(humanoid); tracker.GetTrackerComponent();
} }
} }
else { else {

View File

@ -16,7 +16,7 @@ namespace Passer.Humanoid {
public SensorComponent sensorComponent; public SensorComponent sensorComponent;
/// <summary> /// <summary>
/// Returns sensorComponent and creates a new sensorComponent if it does not exist /// Returns sensorComponent and creates a new SensorComponent if it does not exist
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public abstract SensorComponent GetSensorComponent(); public abstract SensorComponent GetSensorComponent();

View File

@ -8,7 +8,7 @@ namespace Passer.Humanoid {
/// <summary> /// <summary>
/// A %Humanoid tracker /// A %Humanoid tracker
/// </summary> /// </summary>
public class HumanoidTracker : Tracker { public abstract class HumanoidTracker : Tracker {
/// <summary> /// <summary>
/// The humanoid for this tracker /// The humanoid for this tracker
/// </summary> /// </summary>

View File

@ -7,7 +7,7 @@ namespace Passer {
/// <summary> /// <summary>
/// A tracker /// A tracker
/// </summary> /// </summary>
public class Tracker { public abstract class Tracker {
/// <summary> /// <summary>
/// The tracking status /// The tracking status
/// </summary> /// </summary>
@ -36,6 +36,11 @@ namespace Passer {
/// The tracking device /// The tracking device
/// </summary> /// </summary>
public TrackerComponent trackerComponent; public TrackerComponent trackerComponent;
/// <summary>
/// Returns trackerComponent and creates a new TrackerComponent if it does not exist
/// </summary>
/// <returns></returns>
public abstract TrackerComponent GetTrackerComponent();
#region SubTrackers #region SubTrackers

View File

@ -129,6 +129,11 @@ namespace Passer.Humanoid {
#region Manage #region Manage
public override TrackerComponent GetTrackerComponent() {
CheckTracker(humanoid, UnityXR.Get);
return trackerComponent;
}
public override void CheckTracker(HumanoidControl humanoid) { public override void CheckTracker(HumanoidControl humanoid) {
CheckTracker(humanoid, UnityXR.Get); CheckTracker(humanoid, UnityXR.Get);
} }