public override bool?TryInteract(GameObject gameObject)
 {
     if (Input.GetMouseButton(0) && MouseBehavior.MouseOver(Input.mousePosition, gameObject))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public override bool?TryInteract(GameObject gameObject)
 {
     if ((MouseBehavior.MouseOver(Input.mousePosition, gameObject) || isDown) && Input.GetMouseButton(0))
     {
         return(HandleDown());
     }
     else
     {
         return(HandleUp());
     }
 }
Example #3
0
    public override bool?TryInteract(GameObject gameObject)
    {
        if (tijd == null || DateTime.UtcNow >= tijd)
        {
            //debug masks
            if (Input.GetKeyDown(KeyCode.U))
            {
                MouseBehavior.InstantiateDrawRect(gameObject);
            }

            var mouseDownNow = Input.GetMouseButton(0);
            if (mouseDownLast && !mouseDownNow)
            {
                mouseDownLast = mouseDownNow;
                if (clicked)
                {
                    clicked = false;
                    if (MouseBehavior.MouseOver(Input.mousePosition, gameObject))
                    {
                        Debug.LogWarning("Clicked: " + gameObject.name);
                        tijd = DateTime.UtcNow.AddMilliseconds(200);
                        return(true);
                    }
                }
                return(false);
            }
            else if (!mouseDownLast && mouseDownNow)
            {
                mouseDownLast = mouseDownNow;
                if (MouseBehavior.MouseOver(Input.mousePosition, gameObject))
                {
                    Debug.LogWarning("Released: " + gameObject.name);
                    clicked = true;
                }
                return(false);
            }
            mouseDownLast = mouseDownNow;
            if (!mouseDownLast)
            {
                clicked = false;
            }
            return(false);
        }
        else
        {
            return(false);
        }
    }