Beispiel #1
0
    private void Start()
    {
        if (!loadStatus)
        {
            if (!map.deductEnergy(map.getCost(map.modTargetIndex, eventName), map.modTargetIndex))
            {
                map.modTargetIndex = -1;
                Destroy(this.gameObject);
            }

            targetName = target.name;

            target.data.modQueue.Add(eventName);

            map.modTargetIndex = -1;

            ModProbability();
        }
        this.gameObject.transform.position = new Vector3(target.center.x * WorldMap2D.mapWidth, target.center.y * WorldMap2D.mapHeight, 86);
    }
Beispiel #2
0
    public void OnDrag(PointerEventData eventData)
    {
        //MAX!
        holdScript.resetHold();

        if (map.lockDrag)
        {
            map.isOnDrag  = false;
            previousIndex = -1;
            return;
        }


        if (m_DraggingIcons [eventData.pointerId] != null)
        {
            SetDraggedPosition(eventData);

            //MAX!
            if (map.cursorCountryIndex != -1 && map.cursorCountryIndex != previousIndex)
            {
                previousIndex = map.cursorCountryIndex;
                if (map.countries[map.cursorCountryIndex].data.notEliminated)
                {
                    map.possibleCost = map.getCost(previousIndex, ModName);
                    if (map.Energy - map.possibleCost < 0 || map.possibleCost < 0)
                    {
                        map.possibleCost = -1;
                    }
                }
                else
                {
                    map.possibleCost = 0;
                }
            }
            else if (map.cursorCountryIndex == -1)
            {
                map.possibleCost = 0;
            }
        }
    }