boardManager.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        if (turn.getTime() == time) return;
        // Time/step based events
        time = turn.getTime();
        for (int i = 0; i < turretSpawnPoints.Count-1; i++)
        {
            List<int> temp = vecToBoard(turretSpawnPoints[i]);
            tile myTile = board[temp[0], temp[1]];
            if (myTile.hasEnergy() && occupiedByPlayer(turretSpawnPoints[i])) {
                getPlayer(turretSpawnPoints[i]).takeDamage(-1 * dataBase.turretStartEnergy);
                myTile.setEnergy(false);
                GameObject.Destroy(myTile.getEnergy());
            }
        }
        // Turn-based events
        if (turn.getTurn() == tn) return;
        for (int i = 0; i < turretSpawnPoints.Count-1; i++)
        {
            // Spawning a turret while a player's on the spot would cause infinite recursion
            // And that crashes the game, as you might have expected
            if (turretSpawnTimers[i] >= dataBase.turretRespawnTime && !occupiedByPlayer(turretSpawnPoints[i]))
            {
                spawnTurret(turretSpawnPoints[i]);
                turretSpawnTimers[i] = 0;
            }
            else if (turretSpawnTimers[i] >= 1)
            {
                turretSpawnTimers[i]++;
            }
        }
        foreach (blastShield b in blastShields) {
            b.update();
        }
        // This makes sure that the event only happens once per turn
        tn = turn.getTurn();
    }