Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 KB | None | 0 0
  1. [Serializable]
  2. public class Dialogue
  3. {
  4.     // NPC Character which says the line
  5.     [SerializeField]
  6.     private NPCharacter npcCharacter;
  7.     public NPCharacter NpcCharacter => npcCharacter;
  8.  
  9.     // Dialogue line which will be displayed on screen
  10.     [SerializeField, TextArea(3, 5)]
  11.     private string line;
  12.  
  13.     // Enum flag for easier checking which condition apply for dialogue if any
  14.     [Flags]
  15.     public enum DialogueVariables
  16.     {
  17.         Item = 1 << 1,
  18.         Requirement = 1 << 2,
  19.         SetAfterDialogue = 1 << 3,
  20.     };
  21.  
  22.     [SerializeField, EnumToggleButtons]
  23.     private DialogueVariables dialogueVariables;
  24.  
  25.     // Odin Inspector properties for hiding not used properties to remove clutter in inspector
  26.     private bool ShowItemThings => (dialogueVariables & DialogueVariables.Item) == DialogueVariables.Item;
  27.     private bool ShowRequiredThings => (dialogueVariables & DialogueVariables.Requirement) == DialogueVariables.Requirement;
  28.     private bool ShowSetThings => (dialogueVariables & DialogueVariables.SetAfterDialogue) == DialogueVariables.SetAfterDialogue;
  29.  
  30.     // Item required to be held in hand in order to start this dialogue
  31.     [GUIColor(0.8f, 0.8f, 1f, 1f)]
  32.     [SerializeField, ShowIf("ShowItemThings")]
  33.     private Item requiredItem;
  34.     [GUIColor(0.8f, 0.8f, 1f, 1f)]
  35.     [SerializeField, ShowIf("ShowItemThings")]
  36.     private bool removeItem;
  37.  
  38.     // Variables required to have desired values to be able to start this dialogue
  39.     [GUIColor(1f, 0.8f, 0.8f, 1f)]
  40.     [SerializeField, ShowIf("ShowRequiredThings")]
  41.     private List<GlobalVariableCompareTemplate> requirementVariables;
  42.  
  43.     // Variables to be set when dialogue starts
  44.     [GUIColor(0.8f, 1f, 0.8f, 1f)]
  45.     [Space]
  46.     [SerializeField, ShowIf("ShowSetThings")]
  47.     private List<GlobalVariableTemplate> setVariables;
  48.  
  49.     // Accessors and other methods ommited
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement