Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static var clickMaster : Clickable
- function ClickMaster() : Clickable
- {
- if (clickMaster == null)
- {
- clickMaster = this;
- }
- return clickMaster;
- }
- function PixelClick(type : String)
- {
- do the raycast,
- check if a 'clickable' compnent is attached to the collider's GO
- if so, sendmessage "type" to the clickable's root gameobject
- }
- function Update() {
- if (ClickMaster() == this)
- {
- // I am the master of clicks!
- if (Input.GetMouseButtonDown(0)) { PixelClick("LeftMouseDown"); }
- if (Input.GetMouseButtonUp(0)) { PixelClick("LeftMouseUp"); }
- if (Input.GetMouseButtonDown(1)) { PixelClick("RightMouseDown"); }
- if (Input.GetMouseButtonUp(1)) { PixelClick("RightMouseDown"); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment