// Update is called once per frame void Update() { if (InputSubscribers.Count == 0) { return; } Iinput lastSubscriber = InputSubscribers[InputSubscribers.Count - 1]; #if UNITY_STANDALONE || UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { lastSubscriber.OnStart(Input.mousePosition); } if (Input.GetMouseButton(0)) { lastSubscriber.OnMove(Input.mousePosition); } if (Input.GetMouseButtonUp(0)) { lastSubscriber.OnEnd(Input.mousePosition); } #endif #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR if (Input.touchCount > 0) { if (Input.GetTouch(0).phase == TouchPhase.Began) { lastSubscriber.OnStart(Input.GetTouch(0).position); } if (Input.GetTouch(0).phase == TouchPhase.Moved) { lastSubscriber.OnMove(Input.GetTouch(0).position); } if (Input.GetTouch(0).phase == TouchPhase.Ended) { lastSubscriber.OnEnd(Input.GetTouch(0).position); } } #endif }
public void OnStart(Vector3 ScreenPosition) { currentInput.OnStart(ScreenPosition); }