예제 #1
0
파일: CardManager.cs 프로젝트: G0DCH/GOA
    // Start is called before the first frame update
    void Start()
    {
        playernum = PhotonNetwork.playerList.Length;
        if (PhotonNetwork.isMasterClient)
        {
            deck        = new Queue <GameObject>();
            disdeck     = new List <GameObject>();
            playerhands = new List <List <GameObject> >();
            amanager    = GameObject.Find("GameManager").GetComponent <AuctionManager>();

            #region InitArr
            int[]    costarr   = { 500, 1000, 1500, 2000, 500, 1000, 1500, 2000, 500, 1000, 1500, 2000, 500, 1000, 1500, 2000 };
            string[] effectarr =
            { "소지금 15% 증가",           "소지금 30% 증가",        "소지금 45% 증가",        "소지금 60% 증가",
              "상대방 소지금 10% 감소",   "상대방 소지금 20%감소",     "상대방 소지금 30% 감소",    "상대방 소지금 40% 감소",
              "턴 당 수익 10% 증가",    "턴 당 수익 20% 증가",     "턴 당 수익 30% 증가",     "턴 당 수익 40% 증가",
              "상대방 턴 당 수익 5% 감소", "상대방 턴 당 수익 10% 감소", "상대방 턴 당 수익 15% 감소", "상대방 턴 당 수익 20% 감소" };
            int[] categoryarr = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 };
            int[] offarr      = { 15, 30, 45, 60, 10, 20, 30, 40, 10, 20, 30, 40, 5, 10, 15, 20 };
            #endregion

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    GameObject tmp = Instantiate(Card, transform.position, Quaternion.identity);
                    tmp.transform.SetParent(transform);
                    CardSetter tmpsetter = tmp.GetComponent <CardSetter>();
                    if (tmpsetter == null)
                    {
                        Debug.Log(tmp.name + "은 이상 개체");
                    }
                    tmpsetter.SetMyCardInfo(new CardInfo(costarr[j], effectarr[j], categoryarr[j], offarr[j]));
                    disdeck.Add(tmp);
                }
            }

            for (int i = 0; i < playernum; i++)
            {
                playerhands.Add(new List <GameObject>());
            }

            if (PhotonNetwork.isMasterClient)
            {
                CardShuffle();
            }
        }
    }
예제 #2
0
    public void dropcard(GameObject dragobj, int cindex)
    {
        if (dragobj != null && dragobj.tag == "Card")//카드라면 카드의 효과를 송신
        {
            Debug.Log("카드 효과 발동!");
            targetname = gameObject.GetComponent <PlayerInfoUpdater>().PlayerName.text;
            CardSetter           csetter = dragobj.GetComponent <CardSetter>();
            CardManager.CardInfo cinfo   = csetter.GetCardInfo();

            if (AuctionManager.me.GetMoney() < cinfo.CardCost)
            {
                return;
            }
            else
            {
                //카드 효과 발동
                amanager.SendCEffect(PhotonTargets.All, targetname, AuctionManager.me.GetPlayerName(),
                                     cinfo.CardCost, cinfo.CardCategory, cinfo.CardOffset, cindex);
                GameObject.Find("CardManager").GetComponent <CardManager>().DestroyCard(dragobj);
            }
        }
    }
예제 #3
0
 private void Start()
 {
     cardSetter = GameObject.Find("Card").GetComponent <CardSetter>();
 }