2021년 4학년 1학기 기업연계프로젝트2 컴퓨터소프트웨어공학과 <원광투어팀> 팀장 : 송유진 팀원 : 김나영, 이경희, 한유진
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.

68 lines
2.0 KiB

5 years ago
  1. using UnityEngine;
  2. using Unity.InteractiveTutorials;
  3. using UnityEditor;
  4. using UnityEngine.AI;
  5. namespace Unity.Tutorials
  6. {
  7. /// <summary>
  8. /// Implement your Tutorial callbacks here.
  9. /// </summary>
  10. public class TutorialCallbacks : ScriptableObject
  11. {
  12. public FutureObjectReference futureRoomInstance = default;
  13. public FutureObjectReference futureBotInstance = default;
  14. NavMeshSurface navMeshSurface = default;
  15. public bool NavMeshIsBuilt()
  16. {
  17. return navMeshSurface.navMeshData != null;
  18. }
  19. public void ClearAllNavMeshes()
  20. {
  21. if (!navMeshSurface)
  22. {
  23. navMeshSurface = GameObject.FindObjectOfType<NavMeshSurface>();
  24. }
  25. UnityEditor.AI.NavMeshBuilder.ClearAllNavMeshes();
  26. navMeshSurface.navMeshData = null;
  27. }
  28. /// <summary>
  29. /// Keeps the Room selected during a tutorial.
  30. /// </summary>
  31. public void KeepRoomSelected()
  32. {
  33. SelectSpawnedGameObject(futureRoomInstance);
  34. }
  35. /// <summary>
  36. /// Keeps the Room selected during a tutorial.
  37. /// </summary>
  38. public void KeepBotSelected()
  39. {
  40. SelectSpawnedGameObject(futureBotInstance);
  41. }
  42. /// <summary>
  43. /// Selects a GameObject in the scene, marking it as the active object for selection
  44. /// </summary>
  45. /// <param name="futureObjectReference"></param>
  46. public void SelectSpawnedGameObject(FutureObjectReference futureObjectReference)
  47. {
  48. if (futureObjectReference.sceneObjectReference == null) { return; }
  49. Selection.activeObject = futureObjectReference.sceneObjectReference.ReferencedObjectAsGameObject;
  50. }
  51. public void SelectMoveTool()
  52. {
  53. Tools.current = Tool.Move;
  54. }
  55. public void SelectRotateTool()
  56. {
  57. Tools.current = Tool.Rotate;
  58. }
  59. }
  60. }