Example #1
0
    public void RightMouseUpdate()
    {
        if (Input.GetMouseButtonDown(1))
        {
            RaycastHit hit;
            Ray        ray = FindObjectOfType <Camera>().ScreenPointToRay(Input.mousePosition);

            if (!Physics.Raycast(ray, out hit, 1000, Mask))
            {
                return;
            }
            Transform objectHit = hit.transform;

            if (objectHit.TryGetComponent(out Cell cell))
            {
                if (!cell.IsFree)
                {
                    return;
                }
                RightClickEvent?.Invoke();

                cell.SpawnFoundation();
            }
        }
    }
Example #2
0
 private void Press()
 {
     rightClick?.Invoke();
 }
 /// <summary>
 /// Activates the RightClickEvent
 /// </summary>
 /// <param name="e">Event args</param>
 protected virtual void FireRightClickEvent(EventArgs e)
 {
     RightClickEvent?.Invoke(this, e);
 }
Example #4
0
 public void RightClick(object sender, MouseButtonEventArgs args)
 {
     RightClickEvent?.Invoke(sender, args);
 }