Example #1
0
    void StartBP()
    {
        GameStage = "BP";
        BPNumber  = 2;
        GetGold.SetActive(true);
        GetGold.GetComponent <Text> ().text = "移除对手的2张牌";

        //玩家卡牌
        Vector3 PlayerCardPosition = new Vector3(-9, -16, 0);

        for (int i = 0; i < Player_CardListInGame.Count; i++)
        {
            GameObject CardObject_tmp = Instantiate(Card_Prefab, PlayerCardPosition, Quaternion.identity);
            CardObject_tmp.GetComponent <Card> ().Init(Player_CardListInGame[i], true, "Player", "Game");
            Player_CardObjectList.Add(CardObject_tmp);

            PlayerCardPosition += new Vector3(5.5f, 0, 0);
        }

        //机器卡牌
        Vector3 CPUCardPosition = new Vector3(-16, 0, 0);

        for (int i = 0; i < CPU_CardListInGame.Count; i++)
        {
            GameObject CardObject_tmp = Instantiate(Card_Prefab, CPUCardPosition, Quaternion.identity);
            CardObject_tmp.GetComponent <Card> ().Init(CPU_CardListInGame[i], true, "CPU", "Game");
            CPU_CardObjectList.Add(CardObject_tmp);

            CPUCardPosition += new Vector3(5.5f, 0, 0);
        }
    }
Example #2
0
    void Lose()
    {
        GameInfo.GetComponent <GameInfo> ().LostGame();
        GameResult.SetActive(false);

        GetGold.SetActive(true);
        int GoldReword = GameInfo.GetComponent <GameInfo> ().StageList[GameInfo.GetComponent <GameInfo> ().StageLevel - 1].GoldReword;

        GetGold.GetComponent <Text> ().text = "获得" + (GoldReword / 2).ToString() + "金币";

        Invoke("BackToStage", 2.0f);
    }
    public void AddAloneBattleBillboard(Vector3 pos, int num, AloneBattleBillboardType type)
    {
        //return; //By MaiFeo
        AloneBattleBillboard ab = null;

        switch (type)
        {
        case AloneBattleBillboardType.Exp:
            LoggerHelper.Debug("---------Get Exp" + num);
            ab = new GetExp(num);
            break;

        case AloneBattleBillboardType.Gold:
        default:
            LoggerHelper.Debug("---------Get Gold" + num);
            ab = new GetGold(num);
            break;
        }

        ab.SetBillboardPos(pos);
    }
Example #4
0
    void StartGame()
    {
        GameStage = "InGame";
        GetGold.SetActive(false);

        //机器卡牌
        Vector3 CPUCardPosition = new Vector3(-9, 15, 0);

        for (int i = 0; i < CPU_CardObjectList.Count; i++)
        {
            CPU_CardObjectList [i].transform.position = CPUCardPosition;

            CPUCardPosition += new Vector3(5.5f, 0, 0);
        }

        CPUCardUsedID = Random.Range(0, CPU_CardObjectList.Count - 1);
        if (GameInfo.GetComponent <GameInfo> ().Cheat)
        {
            CPU_CardObjectList [CPUCardUsedID].GetComponent <Card> ().ViewPlay();
        }
        CardUsedID = -1;
    }
Example #5
0
    void Win()
    {
        GameInfo.GetComponent <GameInfo> ().WinGame();
        GameResult.SetActive(false);

        GetGold.SetActive(true);
        int GoldReword = GameInfo.GetComponent <GameInfo> ().StageList[GameInfo.GetComponent <GameInfo> ().StageLevel - 1].GoldReword;

        GetGold.GetComponent <Text> ().text = "获得" + GoldReword.ToString() + "金币\n请选择一张牌添加到牌库中";

        string[] t     = { "攻击", "防御", "技能" };
        int      point = Random.Range(1, AddCardLevel + 1);
        string   type  = t [Random.Range(0, 3)];

        AddCardList.Add(new CardInfo(point, "剪", type));

        point = Random.Range(1, AddCardLevel + 1);
        type  = t [Random.Range(0, 3)];
        AddCardList.Add(new CardInfo(point, "石", type));

        point = Random.Range(1, AddCardLevel + 1);
        type  = t [Random.Range(0, 3)];
        AddCardList.Add(new CardInfo(point, "布", type));

        Vector3 CPUCardPosition = new Vector3(-10, 0, 0);

        for (int i = 0; i < AddCardList.Count; i++)
        {
            GameObject CardObject_tmp = Instantiate(Card_Prefab, CPUCardPosition, Quaternion.identity);
            CardObject_tmp.GetComponent <Card> ().Init(AddCardList[i], true, "CPU", "AddCard");
            AddCardObjectList.Add(CardObject_tmp);

            CPUCardPosition += new Vector3(10, 0, 0);
        }
        CancelAddCardButton.SetActive(true);
    }
Example #6
0
    void Start()
    {
        GameInfo = GameObject.Find("GameInfo");
        if (GameInfo == null)
        {
            GameInfo = new GameObject("GameInfo");
            GameInfo.AddComponent <GameInfo>();

            Invoke("Start", 0.5f);
            return;
        }
        GameStage = "Init";

        Player_Health = GameInfo.GetComponent <GameInfo> ().Player_MaxHealth;
        CPU_Health    = GameInfo.GetComponent <GameInfo> ().CPU_MaxHealth;
        AddCardLevel  = GameInfo.GetComponent <GameInfo> ().AddCardLevel;


        SkillList    = GameInfo.GetComponent <GameInfo> ().SkillList;
        Player_Skill = SkillList[GameInfo.GetComponent <GameInfo> ().Player_SKill_Used];
        PlayerSkillcard.GetComponent <SkillCard> ().Init(Player_Skill.Name, Player_Skill.Description);

        CPU_Skill = GameInfo.GetComponent <GameInfo> ().CPU_SKill_Used;
        CPUSkillcard.GetComponent <SkillCard> ().Init(CPU_Skill.Name, CPU_Skill.Description);

        Player_Armor = 0;
        CPU_Armor    = 0;
        GameResult.SetActive(false);
        GetGold.SetActive(false);
        CancelAddCardButton.SetActive(false);

        for (int i = 0; i < GameInfo.GetComponent <GameInfo> ().Player_CardList.Count; i++)
        {
            Player_CardList.Add(GameInfo.GetComponent <GameInfo> ().Player_CardList [i]);
        }

        CPU_CardList = GameInfo.GetComponent <GameInfo> ().CPU_CardList;

        for (int i = 0; i < 5; i++)
        {
            int j = Random.Range(0, Player_CardList.Count);
            Player_CardListInGame.Add(Player_CardList [j]);
            Player_CardList.Remove(Player_CardList [j]);
        }

        for (int i = 0; i < 7; i++)
        {
            int j = Random.Range(0, CPU_CardList.Count);
            CPU_CardListInGame.Add(CPU_CardList [j]);
            CPU_CardList.Remove(CPU_CardList [j]);
        }

        CardInfo tmp;

        for (int i = 0; i < Player_CardListInGame.Count - 1; i++)
        {
            for (int j = Player_CardListInGame.Count - 1; j > i; j--)
            {
                if (Player_CardListInGame [j].Comparer(Player_CardListInGame [j - 1]) < 0)
                {
                    tmp = Player_CardListInGame [j];
                    Player_CardListInGame [j]     = Player_CardListInGame [j - 1];
                    Player_CardListInGame [j - 1] = tmp;
                }
            }
        }

        for (int i = 0; i < CPU_CardListInGame.Count - 1; i++)
        {
            for (int j = CPU_CardListInGame.Count - 1; j > i; j--)
            {
                if (CPU_CardListInGame [j].Comparer(CPU_CardListInGame [j - 1]) < 0)
                {
                    tmp = CPU_CardListInGame [j];
                    CPU_CardListInGame [j]     = CPU_CardListInGame [j - 1];
                    CPU_CardListInGame [j - 1] = tmp;
                }
            }
        }
        Bust_player      = 0;
        Bust_player_last = 0;
        Bust_CPU         = 0;
        Bust_CPU_last    = 0;
        UpdateUI();
        StartBP();
    }
    public void AddAloneBattleBillboard(Vector3 pos, int num, AloneBattleBillboardType type)
    {
        //return; //By MaiFeo
        AloneBattleBillboard ab = null;

        switch (type)
        {
            case AloneBattleBillboardType.Exp:
                LoggerHelper.Debug("---------Get Exp" + num);
                ab = new GetExp(num);
                break;

            case AloneBattleBillboardType.Gold:
            default:
                LoggerHelper.Debug("---------Get Gold" + num);
                ab = new GetGold(num);
                break;
        }

        ab.SetBillboardPos(pos);
    }