Example #1
0
    /// <summary>
    /// 回合数增加
    /// </summary>
    public float AddRound(BaseAction action)
    {
        RoundStartAction roundStartAction = action as RoundStartAction;

        print("当前回合:" + roundStartAction.round);

        return(1f);
    }
Example #2
0
    /// <summary>
    /// 回合数增加
    /// </summary>
    public IEnumerator AddRound(BaseAction action)
    {
        RoundStartAction roundStartAction = action as RoundStartAction;

        roundLabel.text = roundStartAction.round.ToString();

        yield return(new WaitForSeconds(BattleTime.ROUND_CHANGE_TIME));
    }
Example #3
0
    /// <summary>
    /// 开始战斗,第一个玩家先手
    /// </summary>
    public void StartFight()
    {
        fighter0.InitFight();
        fighter1.InitFight();

        // 循环直到一方死亡
        while ((result = CheckWin()) == 0 && !pause && round <= 100)
        {
            round++;

            // 记录回合开始
            actions.Add(RoundStartAction.GetAction(round));

            if (round % 2 == 1)
            {
                fighter0.Action();
            }
            else
            {
                fighter1.Action();
            }

            // 记录回合结束
            actions.Add(RoundEndAction.GetAction(round));

            fighter0.RoundEnd();
            fighter1.RoundEnd();
        }

        foreach (BaseAction action in actions)
        {
            Debug.Log(action.ToString());
        }

        if (result == 1)
        {
            Debug.Log(string.Format("{0}死亡,{1}胜利", fighter1.ID, fighter0.ID));
        }
        else
        {
            Debug.Log(string.Format("{0}死亡,{1}胜利", fighter0.ID, fighter1.ID));
        }
    }