コード例 #1
0
    private void AiThink()
    {
        if (MatchManager.Instance.PlayerTurn)
        {
            return;
        }

        var attackPair = GetAttackPair();

        if (attackPair != null)
        {
            Panel.Fight(attackPair.Attacker.Id, attackPair.Defender.Id);
            MatchManager.Instance.NextTurn();
            return;
        }

        var hiddenCells = MatchManager.Instance.GetAll().FindAll(cell => cell.IsHide && cell.Side > 0);

        if (hiddenCells.Count > 10)//todo temp code
        {
            var openTarget = hiddenCells[MathTool.GetRandom(hiddenCells.Count)];
            Panel.Open(openTarget.Id);
            MatchManager.Instance.NextTurn();
            return;
        }
    }