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(); } } }
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); }
public void RightClick(object sender, MouseButtonEventArgs args) { RightClickEvent?.Invoke(sender, args); }