RedFlys

LeninEyes

Feb 28th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. class LaserEyes
  2. {
  3.     [SerializedField] private TetrisGrid _tetrisGrid;
  4.     private ParticalSystem _particalSystem;
  5.    
  6.     onEnebled
  7.     {
  8.         _tetrisGrid.LeninEyesSwitched += OnLeninEyesSwitched;
  9.     }
  10.  
  11.     onDisabled
  12.     {
  13.         _tetrisGrid.LeninEyesSwitched -= OnLeninEyesSwitched ;
  14.     }
  15.  
  16.     Start
  17.     {
  18.         _particalSystem = GetComponent<ParticalSystem>();
  19.     }
  20.  
  21.     OnLeninSwitched (bool switched)
  22.     {
  23.         if(switched)
  24.             _particalSystem.Play();
  25.         else
  26.             _particalSystem.Stop();
  27.     }
  28. }
  29.  
  30. class TetrisGrid
  31. {  
  32.     private ControllableFigure _controllableFigure;
  33.  
  34.     onEnebled
  35.     {
  36.         _controllableFigure.LeftBorderCrossed += OnLeftBorderCrossed;
  37.     }
  38.  
  39.     onDisabled
  40.     {
  41.         _controllableFigure.LeftBorderCrossed -= OnLeftBorderCrossed;
  42.     }
  43.  
  44.     ...
  45.     StartFigure
  46.     {
  47.         var figure = ...
  48.         ...
  49.         _controllableFigure = figure;  
  50.     }
  51.  
  52.     ...
  53.     OnleftBorderCrossed(bool crossed)
  54.     {
  55.         Invoke?.LeninEyesSwitched(crossed)
  56.     }
  57. }
  58.  
  59. class ContorollableFigure
  60. {
  61.     ...
  62.     {
  63.         Invoke?.LeftBorderCrossed(bool);
  64.     }
  65.     ...
  66. }
Add Comment
Please, Sign In to add comment