Beispiel #1
0
    void Start()
    {
        numberOfPlayers = 3;

        List<List<Transform>> tempPositions = new List<List<Transform>>();
        List<List<CardData>> tempCardList = new List<List<CardData>>();
        List<Transform> tempPos0 = new List<Transform>();
        List<Transform> tempPos1 = new List<Transform>();
        List<Transform> tempPos2 = new List<Transform>();
        List<CardData> tempData0 = new List<CardData>();
        List<CardData> tempData1 = new List<CardData>();
        List<CardData> tempData2 = new List<CardData>();
        tempPositions.Add(tempPos0);
        tempPositions.Add(tempPos1);
        tempPositions.Add(tempPos2);
        tempCardList.Add(tempData0);
        tempCardList.Add(tempData1);
        tempCardList.Add(tempData2);

        // Creation of Player cards //
        for (int i = 0; i < numberOfPlayers; i++){
            decks.Add(tempCardList[i]);
            cards.Add(tempPositions[i]);
            int knight = (int)Encyclopedia.BookOfKnowledge.Knight;
            Player player = CardLibrary.Instance().GetCardData(knight) as Player;
            player = new Player(player);
            player.level = i+2;
            player.ScaleToLevel();
            player.material = Factory.instance.TestBake(player);
            GameObject player_spawn = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
            player_spawn.GetComponent<CardScript>().Prepare(knight, player.material);
            player_spawn.AddComponent<Controller>();
            player_spawn.GetComponent<Controller>().Clone(player);
            players.Add(player_spawn);

            // Creation of Reload card //
            int reload = (int)Encyclopedia.BookOfKnowledge.Reload;
            CardData card = CardLibrary.Instance().GetCardData(reload) as CardData;
            card = new CardData(card);
            card.level = 3;
            card.material = Factory.instance.TestBake(card);
            GameObject reload_spawn = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
            reload_spawn.GetComponent<CardScript>().Prepare(reload, card.material);
            reload_cards.Add(reload_spawn);
        }
        /*
        int test = (int)Encyclopedia.BookOfKnowledge.EnchantressOfSoil;
        Monster monster = CardLibrary.Instance().GetCardData(test) as Monster;
        monster = new Monster(monster);
        monster.level = 14;
        monster.ScaleToLevel();
        monster.material = Factory.instance.TestBake(monster);
        GameObject test_spawn = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
        test_spawn.GetComponent<CardScript>().Prepare(test, monster.material);
        inventory.Add(monster);

        test = (int)Encyclopedia.BookOfKnowledge.DireWolf;
        Monster monster_two = CardLibrary.Instance().GetCardData(test) as Monster;
        monster_two = new Monster(monster_two);
        monster_two.level = 9;
        monster_two.ScaleToLevel();
        monster_two.material = Factory.instance.TestBake(monster_two);
        GameObject test_spawn_two = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
        test_spawn_two.GetComponent<CardScript>().Prepare(test, monster_two.material);
        inventory.Add(monster_two);

        test = (int)Encyclopedia.BookOfKnowledge.FirstCommanderHowe;
        monster = CardLibrary.Instance().GetCardData(test) as Monster;
        monster = new Monster(monster);
        monster.level = 7;
        monster.ScaleToLevel();
        monster.material = Factory.instance.TestBake(monster);
        test_spawn = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
        test_spawn.GetComponent<CardScript>().Prepare(test, monster.material);
        inventory.Add(monster);

        test = (int)Encyclopedia.BookOfKnowledge.BladeOfTheTrinity;
        Weapon weap = CardLibrary.Instance().GetCardData(test) as Weapon;
        weap = new Weapon(weap);
        weap.level = 14;
        weap.ScalePower();
        weap.material = Factory.instance.TestBake(weap);
        test_spawn = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
        test_spawn.GetComponent<CardScript>().Prepare(test, weap.material);
        //test_spawn.GetComponent<CardScript>().SetCardPower(weap.cardpower);
        inventory.Add(weap);
        */

        for (int q = 0; q < numberOfPlayers; q++){

            // Manual addition of cards //
            if (q == 0){
                multiplier.Add(4);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.AngelicLongsword);
                /*
                multiplier.Add(2);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.BlueSaber);
                multiplier.Add(4);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.BladeOfTheTrinity);
                multiplier.Add(1);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.AngelicLongsword);
                */
                //multiplier.Add(2);
                //abilities.Add((int)Encyclopedia.BookOfKnowledge.BrookOfLife);
                //multiplier.Add(1);
                //abilities.Add((int)Encyclopedia.BookOfKnowledge.EmpiricResolve);
            } else {
                multiplier.Add(2);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.BladeOfTheTrinity);
                multiplier.Add(5);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.AngelicLongsword);
                multiplier.Add(1);
                abilities.Add((int)Encyclopedia.BookOfKnowledge.BlueSaber);
            }

            // Compiling and adding cards to inventory //
            for (int i = 0; i < abilities.Count; i++){
                for (int k = 0; k < multiplier[i]; k++){
                    if (CardLibrary.Instance().GetCardData(abilities[i]).GetType() == typeof(Weapon)){
                        Weapon weapon = CardLibrary.Instance().GetCardData(abilities[i]) as Weapon;
                        weapon = new Weapon(weapon);
                        weapon.level = k + 3;
                        weapon.cardpower = k + 3;
                        weapon.ScalePower();
                        decks[q].Add(weapon);
                        inventory.Add(weapon);
                    }
                    if (CardLibrary.Instance().GetCardData(abilities[i]).GetType() == typeof(Item)){
                        Item item = CardLibrary.Instance().GetCardData(abilities[i]) as Item;
                        item = new Item(item);
                        decks[q].Add(item);
                    }
                }
            }

            // Summoning of cards //
            for (int i = 0; i < decks[q].Count; i++){
                decks[q][i].material = Factory.instance.TestBake(decks[q][i]);
                if(i == decks[q].Count-1)
                    Factory.instance.Clear();
                GameObject spawned_card = (GameObject)Instantiate(play_prefab, Vector3.zero, Quaternion.identity);
                cards[q].Add(spawned_card.transform);

                // Prepare card //
                int this_id = decks[q][i].id;
                Material mat = decks[q][i].material;
                spawned_card.GetComponent<CardScript>().Prepare(this_id, mat);
                if(CardLibrary.Instance().GetCardData(this_id).GetType() == typeof(Weapon)){
                    spawned_card.AddComponent<WeaponController>();
                    Weapon weapon = decks[q][i] as Weapon;
                    spawned_card.GetComponent<WeaponController>().Clone(weapon);
                }
            }
            abilities.Clear();
            multiplier.Clear();
        }
    }