コード例 #1
0
ファイル: CharacterBase.cs プロジェクト: ymttkuc/dcg
    //// Update is called once per frame
    //void Update () {
    //       if (Input.GetMouseButtonDown(0)) {
    //           click_start = Input.mousePosition / Screen.height;
    //       }

    //       if (Input.GetMouseButtonUp(0)) {
    //           CardTouch();
    //       }
    //   }

    //   public void SetFocus(bool f) {
    //       focus = f;
    //       card_obj.GetComponent<CardObj>().isSelected = f;
    //   }

    //   //プレイヤーカードをセットする
    //   public bool SetCard(Card c) {

    //       //プレイヤーカードでないならエラー
    //       if (c.origin.type == 1) { return false; }

    //       if (card_obj != null) { Destroy(card_obj); }
    //       card_obj = Instantiate(card_obj_origin, transform.position,
    //           transform.rotation, transform);
    //       card_obj.SetActive(true);

    //       card = c;
    //       var co = card_obj.GetComponent<CardObj>();
    //       co.CardSet(c);
    //       co.isStateChanged = true;
    //       co.LayerSet(0, LAYER);
    //       co.ObjReroad(true);

    //       Utility.SetChildrenTag(card_obj.transform, TAG);

    //       return true;

    //   }

    //カードを入力したとき
    public void SetCard(Card _card)
    {
        if (cardObj == null)
        {
            cardObj = Utility.InstantiateWithTransform(CardObj.GetPrefab(), transform);
        }
        cardObj.GetComponent <CardObj>().card = _card;
    }
コード例 #2
0
ファイル: CardObj.cs プロジェクト: ymttkuc/dcg
    //=================================================================
    //CardObjのUtility

    public static void SetCardObjs(Card[] _cards, ref List <GameObject> _orig_cards)
    {
        for (int i = _orig_cards.Count; _cards.Length <= i; --i)
        {
            Destroy(_orig_cards[i]); _orig_cards.RemoveAt(i);
        }
        for (int i = 0; i < _cards.Length; ++i)
        {
            if (_orig_cards.Count == i)
            {
                _orig_cards.Add(CardObj.GetPrefab());
            }
            _orig_cards[i].GetComponent <CardObj>().SetCard(_cards[i]);
        }
    }