This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Define teleport system profile * Add profile inspector definition * Register system with new profile properly * Fix teleportation * Introduce concept of teleport handler * Implement MixedRealityTeleportSystem v2 * Update submodules
- Loading branch information
Showing
15 changed files
with
220 additions
and
93 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Editor/Profiles/MixedRealityTeleportSystemProfileInspector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using UnityEditor; | ||
using XRTK.Definitions.TeleportSystem; | ||
|
||
namespace XRTK.Editor.Profiles | ||
{ | ||
[CustomEditor(typeof(MixedRealityTeleportSystemProfile))] | ||
public class MixedRealityTeleportSystemProfileInspector : MixedRealityServiceProfileInspector | ||
{ | ||
private SerializedProperty teleportHandlerComponent; | ||
|
||
protected override void OnEnable() | ||
{ | ||
base.OnEnable(); | ||
|
||
teleportHandlerComponent = serializedObject.FindProperty(nameof(teleportHandlerComponent)); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
RenderHeader("The teleport system profile defines default behaviour for the teleport system."); | ||
|
||
serializedObject.Update(); | ||
|
||
EditorGUILayout.PropertyField(teleportHandlerComponent); | ||
|
||
EditorGUILayout.Space(); | ||
base.OnInspectorGUI(); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Editor/Profiles/MixedRealityTeleportSystemProfileInspector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
Runtime/Definitions/TeleportSystem/MixedRealityTeleportSystemProfile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using UnityEngine; | ||
using XRTK.Attributes; | ||
using XRTK.Definitions.Utilities; | ||
using XRTK.Interfaces.TeleportSystem; | ||
using XRTK.Interfaces.TeleportSystem.Handlers; | ||
|
||
namespace XRTK.Definitions.TeleportSystem | ||
{ | ||
/// <summary> | ||
/// Configuration profile for the <see cref="Services.Teleportation.MixedRealityTeleportSystem"/>. | ||
/// </summary> | ||
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Teleport System Profile", fileName = "MixedRealityTeleportSystemProfile", order = (int)CreateProfileMenuItemIndices.Input)] | ||
public class MixedRealityTeleportSystemProfile : BaseMixedRealityServiceProfile<IMixedRealityTeleportDataProvider> | ||
{ | ||
[SerializeField] | ||
[Implements(typeof(IMixedRealityTeleportComponentHandler), TypeGrouping.ByNamespaceFlat)] | ||
[Tooltip("The concrete teleport handler component to use for teleportation.")] | ||
private SystemType teleportHandlerComponent = null; | ||
|
||
/// <summary> | ||
/// The concrete teleport handler component to use for teleportation. | ||
/// </summary> | ||
public SystemType TeleportHandlerComponent => teleportHandlerComponent; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Definitions/TeleportSystem/MixedRealityTeleportSystemProfile.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Runtime/Interfaces/TeleportSystem/Handlers/IMixedRealityTeleportComponentHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace XRTK.Interfaces.TeleportSystem.Handlers | ||
{ | ||
/// <summary> | ||
/// Interface to implement for handling teleport events by the <see cref="IMixedRealityTeleportSystem"/> | ||
/// in <see cref="UnityEngine.MonoBehaviour"/> components. | ||
/// </summary> | ||
public interface IMixedRealityTeleportComponentHandler : IMixedRealityTeleportHandler { } | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Interfaces/TeleportSystem/Handlers/IMixedRealityTeleportComponentHandler.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 10 additions & 7 deletions
17
Runtime/Interfaces/TeleportSystem/Handlers/IMixedRealityTeleportHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
using UnityEngine.EventSystems; | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using UnityEngine.EventSystems; | ||
using XRTK.EventDatum.Teleport; | ||
|
||
namespace XRTK.Interfaces.TeleportSystem | ||
namespace XRTK.Interfaces.TeleportSystem.Handlers | ||
{ | ||
/// <summary> | ||
/// Interface to implement for teleport events. | ||
/// Interface to implement for handling teleport events by the <see cref="IMixedRealityTeleportSystem"/>. | ||
/// </summary> | ||
public interface IMixedRealityTeleportHandler : IEventSystemHandler | ||
{ | ||
/// <summary> | ||
/// Raised when a pointer requests a teleport target, but no teleport has begun. | ||
/// </summary> | ||
/// <param name="eventData"></param> | ||
/// <param name="eventData">Teleport event data.</param> | ||
void OnTeleportRequest(TeleportEventData eventData); | ||
|
||
/// <summary> | ||
/// Raised when a teleport has started. | ||
/// </summary> | ||
/// <param name="eventData"></param> | ||
/// <param name="eventData">Teleport event data.</param> | ||
void OnTeleportStarted(TeleportEventData eventData); | ||
|
||
/// <summary> | ||
/// Raised when a teleport has successfully completed. | ||
/// </summary> | ||
/// <param name="eventData"></param> | ||
/// <param name="eventData">Teleport event data.</param> | ||
void OnTeleportCompleted(TeleportEventData eventData); | ||
|
||
/// <summary> | ||
/// Raised when a teleport request has been canceled. | ||
/// </summary> | ||
/// <param name="eventData"></param> | ||
/// <param name="eventData">Teleport event data.</param> | ||
void OnTeleportCanceled(TeleportEventData eventData); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Runtime/Interfaces/TeleportSystem/IMixedRealityTeleportDataProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) XRTK. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
namespace XRTK.Interfaces.TeleportSystem | ||
{ | ||
/// <summary> | ||
/// The base interface to define teleportation data providers. | ||
/// </summary> | ||
public interface IMixedRealityTeleportDataProvider : IMixedRealityDataProvider { } | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Interfaces/TeleportSystem/IMixedRealityTeleportDataProvider.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.