private void Update() { if (Input.GetMouseButtonDown(0)) { OnMouseDownEvent.Invoke(this, new MouseDownEventArgs("Hello!")); } }
private void OnMouseDown() { Vector2 mPos = Input.mousePosition; mPos = Camera.main.ScreenToWorldPoint(mPos); Vector2 dis = ((Vector2)rabbitCtrl.transform.position - mPos).normalized; rabbitCtrl.dir = Mathf.Abs(dis.x) > Mathf.Abs(dis.y) ? Vector2Int.left * System.Convert.ToInt32(dis.x) : Vector2Int.up * System.Convert.ToInt32(dis.y); downEvent.Invoke(); }
void OnMouseDown() { //Debug.LogFormat("OnMouseDown"); //Debug.LogFormat("OnMouseDown != null"); onMouseDown?.Invoke(this); firstPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); tween = transform.DOPath( new Vector3[] { transform.position, new Vector3(transform.position.x, transform.position.y + 0.1f, transform.position.z), transform.position }, .8f); }
void OnMouseDown() { onTrigger.Invoke(gameObject); }