Exemplo n.º 1
0
    public void startBattle()
    {
        resourceManager       = GetComponent <resourceManager>();
        logManager            = GetComponent <logManager>();
        cameraManager         = GetComponent <cameraManager>();
        mapManager            = GetComponent <mapManager>();
        unitPanelManager      = GetComponent <unitPanelManager>();
        topPanelManager       = GetComponent <topPanelManager>();
        equipmentPanelManager = GetComponent <equipmentPanelManager>();
        mapManager.initialize();
        mapManager.generateMap();
        mapManager.avalibityMapReset(false);
        cameraManager.initilize();
        unitPanelManager.intialize();
        topPanelManager.initialize();
        equipmentPanelManager.initialize();         //temponary location

        allUnits = resourceManager.getActiveRooster();
        allUnits.AddRange(resourceManager.getEnemyRooster());
        foreach (Unit unit in allUnits)
        {
            unit.setPawn(resourceManager.getPawnPrefab());
            unit.setPawnPosition(grid.CellToWorld(new Vector3Int(unit.getPosition()[0], unit.getPosition()[1], 0)));
            unit.rollInitiative();
            mapManager.placeUnit(unit.getPosition());
        }
        mapManager.avalibityMapReset(false);
        unitsToGo = allUnits;
        GameState = gameState.endTurn;
    }