Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InputManager
- {
- public Vector2 CursorPosition;
- public event Action RightClick;
- void OnRightClick()
- {
- RightClick.Invoke();
- }
- }
- class Ghost
- {
- private InputManager _input;
- public Ghost(InputManager _inputManager)
- {
- _input = _inputManager;
- _inputManager.RightClick += InputManagerOnRightClick;
- }
- private void InputManagerOnRightClick()
- {
- PlaceBuildingOnPosition(_input.CursorPosition);
- }
- void Tick()
- {
- this.position = _input.CursorPosition;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement