コード例 #1
0
ファイル: test.cs プロジェクト: professorlust/Card_Game_Demo
    void Init()
    {
        for (int i = 0; i < 5; i++)
        {
            MysteryCard m = new MysteryCard();
            m.Name = "MysteryCard_" + i.ToString();
            TreasureCard t = new TreasureCard();
            t.Name = "TreasureCard_" + i.ToString();
            icards.Add(m);
            icards.Add(t);
        }

        foreach (ICard c in icards)
        {
            TreasureCard t = c as TreasureCard;
            if (t != null)
            {
                tCards.Add(t);
            }
        }

        foreach (TreasureCard tc in tCards)
        {
            GameObject go = new GameObject();
            go.AddComponent <TreasureCardMono>();
            go.transform.name = tc.Name;
            go.GetComponent <TreasureCardMono>().Gold        = tc.Gold;
            go.GetComponent <TreasureCardMono>().Power       = tc.Power;
            go.GetComponent <TreasureCardMono>().Name        = tc.Name;
            go.GetComponent <TreasureCardMono>().Description = tc.Description;
        }
        Debug.Log("break");
    }
コード例 #2
0
        static void Main()
        {
            List <CardType> CT = new List <CardType>();

            CT.Add(new CardType());
            List <MysteryCard> MC = new List <MysteryCard>();

            MC.Add(new MysteryCard());
            List <TreasureCard> TC = new List <TreasureCard>();

            TC.Add(new TreasureCard());
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            while (CT[0] != CardType.none)
            {
                Application.Run(new Munch_Card_Saving_CC(CT));
                if (CT[0] == CardType.MYSTERY)
                {
                    MC[0] = new MysteryCard();
                    Application.Run(new Mystery_Info(MC));
                }
                if (CT[0] == CardType.TREASURE)
                {
                    TC[0] = new TreasureCard();
                    Application.Run(new Treasure_Info(TC));
                }
            }
        }