コード例 #1
0
ファイル: OkeyController.cs プロジェクト: farukcan/okeycase
    void Start()
    {
        instance = this;
        table    = new Table();
        deck     = table.decks[0];
        prototypeCard.gameObject.SetActive(false);
        table.cards.ForEach((card) => {
            DraggableCard obj        = Instantiate(prototypeCard, transform);
            obj.id                   = (int)card.id;
            obj.color.color          = colors[(int)card.Color];
            obj.number.color         = colors[(int)card.Color];
            obj.number.text          = card.Number.ToString();
            RectTransform rtransform = obj.GetComponent <RectTransform>();
            rtransform.Translate(Random.onUnitSphere * 500);

            obj.gameObject.SetActive(false);
            cardPooling.Add(obj);
        });

        for (int i = 0; i < slots.Length; i++)
        {
            slots[i].id = i;
        }
        prototypeCard.gameObject.SetActive(true);

        Distribute();
    }
コード例 #2
0
ファイル: TargetManager.cs プロジェクト: tsvetkov89/CCG_D_E
 public void PointerInit(DraggableCard draggableCard)
 {
     _draggableCard = draggableCard;
     var component = _draggableCard.GetComponent<ActionsWithCards>();
     _selectedCard = component.CardGame;
     _draggeblePointer.Init(_draggableCard, _selectedCard.GetDataCard().Application);
 }
コード例 #3
0
ファイル: OkeyController.cs プロジェクト: farukcan/okeycase
 void Update()
 {
     for (int i = 0; i < slots.Length; i++)
     {
         if (deck.slots[i] != null)
         {
             DraggableCard draggableCard = cardPooling[(int)deck.slots[i].id];
             draggableCard.targetSlot = i;
             if (draggableCard.onDrag)
             {
                 continue;
             }
             draggableCard.gameObject.SetActive(true);
             RectTransform rtransformForCard = draggableCard.GetComponent <RectTransform>();
             RectTransform rtransformForSlot = slots[i].GetComponent <RectTransform>();
             rtransformForCard.position = Vector3.Lerp(rtransformForCard.position, rtransformForSlot.position, Time.deltaTime * dragForce);
         }
     }
 }