You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.0 KiB
69 lines
2.0 KiB
using UnityEngine;
|
|
using Unity.InteractiveTutorials;
|
|
using UnityEditor;
|
|
using UnityEngine.AI;
|
|
|
|
namespace Unity.Tutorials
|
|
{
|
|
/// <summary>
|
|
/// Implement your Tutorial callbacks here.
|
|
/// </summary>
|
|
public class TutorialCallbacks : ScriptableObject
|
|
{
|
|
public FutureObjectReference futureRoomInstance = default;
|
|
public FutureObjectReference futureBotInstance = default;
|
|
NavMeshSurface navMeshSurface = default;
|
|
|
|
public bool NavMeshIsBuilt()
|
|
{
|
|
return navMeshSurface.navMeshData != null;
|
|
}
|
|
|
|
public void ClearAllNavMeshes()
|
|
{
|
|
if (!navMeshSurface)
|
|
{
|
|
navMeshSurface = GameObject.FindObjectOfType<NavMeshSurface>();
|
|
}
|
|
UnityEditor.AI.NavMeshBuilder.ClearAllNavMeshes();
|
|
navMeshSurface.navMeshData = null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Keeps the Room selected during a tutorial.
|
|
/// </summary>
|
|
public void KeepRoomSelected()
|
|
{
|
|
SelectSpawnedGameObject(futureRoomInstance);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Keeps the Room selected during a tutorial.
|
|
/// </summary>
|
|
public void KeepBotSelected()
|
|
{
|
|
SelectSpawnedGameObject(futureBotInstance);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Selects a GameObject in the scene, marking it as the active object for selection
|
|
/// </summary>
|
|
/// <param name="futureObjectReference"></param>
|
|
public void SelectSpawnedGameObject(FutureObjectReference futureObjectReference)
|
|
{
|
|
if (futureObjectReference.sceneObjectReference == null) { return; }
|
|
Selection.activeObject = futureObjectReference.sceneObjectReference.ReferencedObjectAsGameObject;
|
|
}
|
|
|
|
public void SelectMoveTool()
|
|
{
|
|
Tools.current = Tool.Move;
|
|
}
|
|
|
|
public void SelectRotateTool()
|
|
{
|
|
Tools.current = Tool.Rotate;
|
|
}
|
|
}
|
|
}
|