コード例 #1
0
 public void clearDropzZones()
 {
     zone1Capturer.OnMouseDown();
     zone2Capturer.OnMouseDown();
     zone1HasElement = false;
     zone2HasElement = false;
 }
コード例 #2
0
    public void OnMouseDown()
    {
        //clears the zone if it contains a base element
        if (containsBaseElement)
        {
            containsBaseElement     = false;
            myElementSprite.enabled = false;
            compiler.OnMouseDown();
            setEmptyMessage();
        }

        //disables crafting when there are not two elements
        if (!zone1HasElement || !zone2HasElement)
        {
            elementIsReadyToCraft = false;
        }
        else
        {
            //plays the zone animations if either one has insuficent resources
            if (PlayerPrefs.GetInt(parentElement1) <= 0)
            {
                zone1Capturer.playNoElementsAnimation();
            }

            if (PlayerPrefs.GetInt(parentElement2) <= 0)
            {
                zone2Capturer.playNoElementsAnimation();
            }
        }

        if (elementIsReadyToCraft)
        {
            //calls the event to create an element
            if (OnElementCreated != null)
            {
                Utility.Log("created an element and fired the event");
                OnElementCreated(resultElement, parentElement1, parentElement2, isNew);
            }
        }
        else if (invalidCombination)
        {
            if (OnIncorrectCraft != null)
            {
                OnIncorrectCraft();
            }
        }
    }
コード例 #3
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (m_DraggingIcon != null)
        {
            Destroy(m_DraggingIcon);
            //clears the element from the zone
            if (isDropZone || isCompiler)
            {
                zoneController.OnMouseDown();
            }

            if (isCompiler)
            {
                GlobalVars.CRAFTER.clearDropzZones();
            }
        }
    }