Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. class InputManager
  2. {
  3.     public Vector2 CursorPosition;
  4.     public event Action RightClick;
  5.  
  6.     void OnRightClick()
  7.     {
  8.         RightClick.Invoke();
  9.     }
  10. }
  11.  
  12. class Ghost
  13. {
  14.     private InputManager _input;
  15.  
  16.     public Ghost(InputManager _inputManager)
  17.     {
  18.         _input = _inputManager;
  19.         _inputManager.RightClick += InputManagerOnRightClick;
  20.     }
  21.  
  22.     private void InputManagerOnRightClick()
  23.     {
  24.         PlaceBuildingOnPosition(_input.CursorPosition);
  25.     }
  26.  
  27.     void Tick()
  28.     {
  29.         this.position = _input.CursorPosition;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement