Пример #1
0
    // Makes a move. Decides what to do and where to place.
    // TODO: implement what-to-do decision
    public override void MakeMove()
    {
        if (!isInitialized)
        {
            Init();
            isInitialized = true;
        }
        gridEvaluator.UpdateRating();
        gridEvaluator.ShowBestPositions();
        RatedPosition bp = gridEvaluator.BadlyPlacedTower();

        if (bp != null)
        {
            player.SellTower(bp.tile.xPos, bp.tile.yPos);
        }

        Action bestAction = actionEvaluator.GetBestAction(GetTowerFromPlayer(player), GetTowerFromPlayer(enemy), spawner.GetNextEnemy());

        //Debug.Log(bestAction);
        switch (bestAction)
        {
        case Action.BuildOrUpgrade:
            AIBuild();
            break;

        case Action.Destroy:
            AIDestroy();
            break;

        case Action.Send:
            AISend();
            break;

        case Action.Upgrade:
            AIUpgrade();
            break;

        case Action.Nothing:
        default:
            break;
        }
    }