Пример #1
0
 public bool Click(out TargetObject target)
 {
     target = null;
     for (int i = 0; i < targetObjectManager.targets.Count; i++)
     {
         float pos = targetObjectManager.targets[i].GetPos();
         if (pos >= areaLowerLimit)
         {
             if (pos < areaUpperLimit)
             {
                 target = targetObjectManager.targets[i];
                 if (target.id == id && target.GetIsClicked() != true)
                 {
                     target.SetIsClicked(true);
                     ClickEffect obj = objectPool.GetItem(clickEffect, null).GetComponent <ClickEffect>();
                     obj.transform.localPosition = Vector3.zero;
                     obj.Play(target.transform);
                     return(true);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     return(false);
 }
Пример #2
0
    public void LoadList(List <Card> myCards, bool shuffle = true, ClickEffect clickEffect = ClickEffect.nothing, Zones zone = Zones.master, bool forSale = false, bool free = true, int cap = -99)
    {
        List <Card> copyOfmyCards = new List <Card>();
        int         i             = 0;

        copyOfmyCards.AddRange(myCards);
        if (shuffle)
        {
            ShuffleList.Shuffle <Card>(copyOfmyCards);
        }
        print(clickEffect);
        foreach (Card card in copyOfmyCards)
        {
            if (clickEffect == ClickEffect.upgrade && card.CanUpgrade == false)
            {
                continue;
            }
            GameObject         newCard    = Instantiate(ListItemPrefab) as GameObject;
            ListItemController controller = newCard.GetComponentInChildren <ListItemController>();
            controller.myCard = card;

            controller.icon.sprite = card.mySprite;

            controller.clickEffect = clickEffect;
            controller.zone        = zone;
            controller.free        = free;

            if (forSale)
            {
                controller.UiText.text = "Cost: " + card.FactoryCost;
            }
            newCard.transform.SetParent(ControlPanel.transform, false);
            newCard.transform.localScale = Vector3.one;
            i++;
            if (i >= cap && cap > 0)
            {
                break;
            }
        }
    }
Пример #3
0
 public static void SetClickEffect(Button button, ClickEffect value)
 {
     button.SetValue(ClickEffectProperty, value);
 }
Пример #4
0
 public static void SetClickEffect(RepeatButton repeatButton, ClickEffect value)
 {
     repeatButton.SetValue(ClickEffectProperty, value);
 }