apieceoffruit

Example

May 18th, 2021
635
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public interface Messages
  2. {
  3.     void Say(string message);
  4. }
  5.  
  6. public class UnityConsoleMessages : Messages
  7. {
  8.     public void Say(string message) => Debug.Log(message);
  9. }
  10.  
  11. public class TMP_TextMessages : Messages
  12. {
  13.     TMP_Text _label;
  14.    public TMP_TextMessages(TMP_Text label) => _label = label;
  15.  
  16.     public void Say(string message) => _label += $"{message}\n";
  17.  
  18. }
  19.  
  20.  
  21. public class SomeSystem
  22. {
  23.    Messages _messages;
  24.    public SomeSystem(Message messages) =>
  25.       _messages = messages;
  26.    
  27.  
  28.     public void Enter() =>
  29.       _messages.Say($"{this.GetType().Name } Entered!");
  30.    
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
RAW Paste Data