TutorialTexts.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //***********************************************************
  2. // Filename: TutorialTexts.cs
  3. // Author: Moritz Kolvenbach, Marco Fendrich
  4. // Last changes: Thursday, 9th of August 2018
  5. // Content: Selector for tutorial text according to teleportation
  6. //***********************************************************
  7. using UnityEngine;
  8. using UnityEngine.UI;
  9. /// <summary>
  10. /// Selector for tutorial text according to teleportation
  11. /// </summary>
  12. public class TutorialTexts : MonoBehaviour
  13. {
  14. // public text of teleport
  15. public static Text tutorialText;
  16. // holder of used teleport
  17. public ControllerInput functionsInUse;
  18. // teleports being differentiated
  19. private LinearTeleport linearTeleport;
  20. private ParabolicTeleport parabolicTeleport;
  21. private AngleSelectTeleport angleSelectTeleport;
  22. void Start()
  23. {
  24. // try to cast controller function as different teleports to see which is in use
  25. linearTeleport = functionsInUse.touchpadButtonCall as LinearTeleport;
  26. parabolicTeleport = functionsInUse.touchpadButtonCall as ParabolicTeleport;
  27. angleSelectTeleport = functionsInUse.touchpadButtonCall as AngleSelectTeleport;
  28. // set texts according to teleport being set in controller
  29. // this has to be done in order of children to parent as otherwise the cascade will trigger early
  30. if (angleSelectTeleport != null)
  31. {
  32. tutorialText.text = "Press down on the touchpad again. When teleporting, you will face into the direction of the red indicator line on the orange selector. This depends on where your finger is on the touchpad when you release it.";
  33. GetComponentInParent<GameManager>().movementMethod = "AngleSelectTeleport";
  34. }
  35. else if (parabolicTeleport != null)
  36. {
  37. tutorialText.text = "Press down on the touchpad to cast a parabolic line. Release the touchpad to teleport to the location indicated by the orange selector. A red cross again means you cannot teleport into that area.";
  38. GetComponentInParent<GameManager>().movementMethod = "ParabelTeleport";
  39. }
  40. else if (linearTeleport != null)
  41. {
  42. tutorialText.text = "Press down on the touchpad and aim where you want to teleport. An orange indicator means you will teleport on release, a red cross means you cannot teleport to that point.";
  43. GetComponentInParent<GameManager>().movementMethod = "LinearTeleport";
  44. }
  45. }
  46. }