Advertisement
Guest User

Untitled

a guest
Aug 16th, 2022
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. /*
  2. *
  3. * Adventure Creator
  4. * by Chris Burton, 2013-2020
  5. *
  6. * "ActionTemplate.cs"
  7. *
  8. * This is a blank action template.
  9. *
  10. */
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using UnityEngine;
  14. using UnityEngine.UI;
  15. #if UNITY_EDITOR
  16. using UnityEditor;
  17. #endif
  18.  
  19. namespace AC
  20. {
  21.  
  22. [System.Serializable]
  23. public class ActionChangeFontColor : Action
  24. {
  25.  
  26. // Declare variables here
  27.  
  28. public Text mytext;
  29. public Color mycolor = Color.white;
  30. public ActionChangeFontColor ()
  31. {
  32. this.isDisplayed = true;
  33. category = ActionCategory.Custom;
  34. title = "Change Font Color";
  35. description = "It changes the font color I guess.";
  36. }
  37.  
  38.  
  39. override public float Run ()
  40. {
  41. /*
  42. * This function is called when the action is performed.
  43. *
  44. * The float to return is the time that the game
  45. * should wait before moving on to the next action.
  46. * Return 0f to make the action instantenous.
  47. *
  48. * For actions that take longer than one frame,
  49. * you can return "defaultPauseTime" to make the game
  50. * re-run this function a short time later. You can
  51. * use the isRunning boolean to check if the action is
  52. * being run for the first time, eg:
  53. */
  54. mytext.color = mycolor;
  55.  
  56.  
  57. return 0f;
  58. }
  59.  
  60.  
  61.  
  62. public override void Skip ()
  63. {
  64. /*
  65. * This function is called when the Action is skipped, as a
  66. * result of the player invoking the "EndCutscene" input.
  67. *
  68. * It should perform the instructions of the Action instantly -
  69. * regardless of whether or not the Action itself has been run
  70. * normally yet. If this method is left blank, then skipping
  71. * the Action will have no effect. If this method is removed,
  72. * or if the Run() method call is left below, then skipping the
  73. * Action will cause it to run itself as normal.
  74. */
  75.  
  76. Run ();
  77. }
  78.  
  79.  
  80. #if UNITY_EDITOR
  81.  
  82. public override void ShowGUI ()
  83. {
  84. mytext = (Text) EditorGUILayout.ObjectField ("Text:", mytext, typeof (Text), false);
  85. mycolor = (Color) EditorGUILayout.ColorField ("Color:", mycolor);
  86.  
  87.  
  88.  
  89. AfterRunningOption ();
  90. }
  91.  
  92.  
  93. public override string SetLabel ()
  94. {
  95. // (Optional) Return a string used to describe the specific action's job.
  96.  
  97. return string.Empty;
  98. }
  99.  
  100. #endif
  101.  
  102. }
  103.  
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement