Beispiel #1
0
    public void Turn()
    {
        bool turn = false;

        if (state == RoundState.PlayerRurn)
        {
            state = RoundState.NpcTurn;
            turn  = false;
        }
        else if (state == RoundState.NpcTurn)
        {
            state = RoundState.PlayerRurn;
            turn  = true;
        }
        UIRound round = (UIRound)UIPage.GetPageInstatnce <UIRound>();

        round.SetTurnBtn(turn);
        if (CurrentRound < roundData.maxRound)
        {
            CurrentRound++;
        }
        UIRoundData[3] = RemainRound;
        round.UpdateDataShow();
        DealCards();
    }
Beispiel #2
0
    //开始
    public IEnumerator StartBattle()
    {
        yield return(new WaitUntil(() => { return DataReady; }));

        fighting = true;
        state    = RoundState.Begin;

        yield return(new WaitUntil(() => {
            cardpad = (UICardPad)UIManager.Instance.GetPageInstatnce <UICardPad>();
            return cardpad != null;
        }));

        cardpad.ClearTable();
        DealCards();
        CurrentRound = 0;
        if (MathUtil.GetRandom(0, 1) == 1)
        {
            state = RoundState.PlayerRurn;
        }
        else
        {
            state = RoundState.NpcTurn;
        }
        UIRound round = (UIRound)UIPage.GetPageInstatnce <UIRound>();

        round.SetTurnBtn(state == RoundState.PlayerRurn?true:false);
    }
Beispiel #3
0
    //玩家使用卡牌
    public bool UseCard(CardDataObj card, int role)
    {
        if (role == 1 && state != RoundState.PlayerRurn)
        {
            return(false);
        }
        if (role == 2 && state != RoundState.NpcTurn)
        {
            return(false);
        }
        RoleProperty self  = null;
        RoleProperty enemy = null;

        if (state == RoundState.PlayerRurn)
        {
            self  = PlayerAtt.property;
            enemy = NPCAtt.property;
        }
        else if (state == RoundState.NpcTurn)
        {
            self  = NPCAtt.property;
            enemy = PlayerAtt.property;
        }
        Debug.Log(card.data.CardName);
        for (int i = 0; i < card.data.functions.Length; i++)
        {
            FunctionData data = card.data.functions[i];
            if (data.target == EnumProperty.TargetType.Self || data.target == EnumProperty.TargetType.All)
            {
                CaculateSystem.Instance.Caculate(data.type, data.func, ref self, data.Values);
            }
            if (data.target == EnumProperty.TargetType.Enemy || data.target == EnumProperty.TargetType.All)
            {
                CaculateSystem.Instance.Caculate(data.type, data.func, ref enemy, data.Values);
            }
        }

        EntityCenter.Instance.ReleaseCard(card.gameObject);
        UIRound round = (UIRound)UIPage.GetPageInstatnce <UIRound>();

        UIRoundData[3] = RemainRound;
        round.UpdateDataShow();
        return(true);
    }
Beispiel #4
0
 public UIPage GetPageInstatnce <T>() where T : UIPage, new()
 {
     return(UIPage.GetPageInstatnce <T>());
 }