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; }
IEnumerator move(AStar aStar, Vector3Int pos, float time) { //mapManager.getMap().getTile(activeUnit.getPosition()[0], activeUnit.getPosition()[1]).setIsOccupied(false); List <AStarTile> path = aStar.getPath(); foreach (AStarTile tile in path) { yield return(new WaitForSeconds(resourceManager.getUnitMovementSpeed())); activeUnit.setPosition(tile.X, tile.Y); activeUnit.setPawnPosition(grid.CellToWorld(new Vector3Int(activeUnit.getPosition()[0], activeUnit.getPosition()[1], 0))); } Debug.Log("今"); activeUnit.setPosition(pos.x, pos.y); mapManager.placeUnit(activeUnit.getPosition()); activeUnit.setPawnPosition(grid.CellToWorld(new Vector3Int(activeUnit.getPosition()[0], activeUnit.getPosition()[1], 0))); activeUnit.useAction(); unitPanelManager.actionRunesUpdate(); mapManager.avalibityMapReset(false); mapManager.placeUnit(activeUnit.getPosition()); GameState = gameState.idle; }