Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. public class ActionSay : ActionSpeech
  2. {
  3.     public ActionSay()
  4.     {
  5.         this.isDisplayed = true;
  6.         category = ActionCategory.Custom;
  7.         title = "Say";
  8.         description = "Say by Manifest.CharacterType";
  9.     }
  10.  
  11.     public Manifest.CharacterType manifestSpeaker;
  12.     List<ActionParameter> theParameters;
  13.  
  14. #if UNITY_EDITOR
  15.     public override void ShowGUI(List<ActionParameter> parameters)
  16.     {
  17.         manifestSpeaker = (Manifest.CharacterType)EditorGUILayout.EnumPopup("Speaker:", manifestSpeaker);
  18.  
  19.         EditorGUILayout.BeginHorizontal();
  20.         EditorGUILayout.LabelField("Line text:", GUILayout.Width(65f));
  21.         EditorStyles.textField.wordWrap = true;
  22.         messageText = EditorGUILayout.TextArea(messageText, GUILayout.MaxWidth(400f));
  23.         EditorGUILayout.EndHorizontal();
  24.  
  25.         theParameters = parameters;
  26.  
  27.         AfterRunningOption();
  28.     }
  29. #endif
  30.  
  31.     override public float Run()
  32.     {
  33.         speaker = CharactersManager.I.FindCharacterByType(manifestSpeaker); // returns a Char
  34.         Debug.Log(speaker.GetName(0)); //  this displays the Char name correctly, so it's found it.
  35.         Debug.Log("MESSAGE TEXT: " + messageText); // this displays the message text correctly
  36.         base.Run();
  37.  
  38.         return -1f; // if I return 0 here, any 2nd line in messageText is ignored. At -1 the Debug info is displayed 100x
  39.     }
  40.  
  41.     override public void AssignValues(List<ActionParameter> parameters)
  42.     {
  43.         base.AssignValues(parameters);
  44.     }
  45.  
  46.     override public void AssignParentList(ActionList actionList)
  47.     {
  48.         base.AssignParentList(actionList);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement