deltavr multiplayer 2.0
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityEngine.XR.Content.Walkthrough
|
||||
{
|
||||
/// <summary>
|
||||
/// Trigger that, when active, waits for a UI button to be pressed
|
||||
/// </summary>
|
||||
internal class ButtonPressTrigger : WalkthroughTrigger
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[SerializeField]
|
||||
[Tooltip("The UI button that when pressed, will allow this trigger to pass.")]
|
||||
Button m_ButtonToPress;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Allow pressing of the button switch the step of the tutorial")]
|
||||
bool m_SwitchContext = true;
|
||||
|
||||
#pragma warning restore 649
|
||||
bool m_Triggered = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (m_ButtonToPress == null)
|
||||
return;
|
||||
|
||||
m_ButtonToPress.onClick.RemoveListener(ButtonPressHandler);
|
||||
m_ButtonToPress.onClick.AddListener(ButtonPressHandler);
|
||||
}
|
||||
|
||||
public override bool ResetTrigger()
|
||||
{
|
||||
m_Triggered = false;
|
||||
if (m_ButtonToPress == null)
|
||||
return false;
|
||||
|
||||
m_ButtonToPress.onClick.RemoveListener(ButtonPressHandler);
|
||||
m_ButtonToPress.onClick.AddListener(ButtonPressHandler);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Check()
|
||||
{
|
||||
return m_Triggered;
|
||||
}
|
||||
|
||||
void ButtonPressHandler()
|
||||
{
|
||||
// Attempt to switch to this step if this button is not part of the current step
|
||||
if (m_SwitchContext)
|
||||
{
|
||||
var parent = GetComponentInParent<WalkthroughStep>();
|
||||
var walkthrough = GetComponentInParent<Walkthrough>();
|
||||
if (parent != null && walkthrough != null)
|
||||
{
|
||||
var steps = walkthrough.steps;
|
||||
var stepIndex = Array.IndexOf(steps, parent);
|
||||
if (stepIndex != walkthrough.currentStep)
|
||||
walkthrough.SkipToStep(stepIndex);
|
||||
}
|
||||
}
|
||||
|
||||
m_Triggered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 489565b6c95bfbc49b1681ab52f265ea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace UnityEngine.XR.Content.Walkthrough
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all triggers used by walkthrough steps.
|
||||
/// </summary>
|
||||
abstract public class WalkthroughTrigger : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// Attempts to return a trigger to a state where it can be activated again
|
||||
/// </summary>
|
||||
/// <returns>False if this trigger cannot be reset or would automatically fire</returns>
|
||||
public abstract bool ResetTrigger();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if this trigger's pass/fail condition is active
|
||||
/// </summary>
|
||||
/// <returns>True if this trigger is no longer blocking the current walkthrough step</returns>
|
||||
public abstract bool Check();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f562431b9a534d4c8f265289a8b51ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user