예제 #1
0
    private void ProcessRightClick(Vector3 mouseClickPos)                       //Brings up interaction options menu
    {
        RaycastHit2D      hit = Physics2D.Raycast(mouseClickPos, Vector2.zero); //Vector2.zero == (0,0)
        List <Collider2D> interactablesFound = CheckForUnits(mouseClickPos);

        if (interactablesFound.Count <= 1)
        {
            Collider2D collider = hit.collider;
            if (collider)
            {
                CheckForInteractableMenu(collider);
            }
        }
        else
        {
            SelectInteractable.SpawnMenu(interactablesFound);
        }
    }
예제 #2
0
    public void DestroyPopupMenus()
    {
        //these are probably fine as singletons, the alternative would be to have these be in the toolbox, and they talk to
        //a script that is on the actual gameobject and can access the children. It will decouple things slightly

        if (InteractableMenu.instance != null)
        {
            InteractableMenu.instance.CloseMenu();
        }

        if (EquipmentStats.instance != null)
        {
            EquipmentStats.instance.CloseMenu();
        }

        if (ItemMenu.instance != null)
        {
            ItemMenu.instance.CloseMenu();
        }

        SelectInteractable.Destroy();
    }