public void OnStartBattle() { //----------------------------------------------------------------------------------------------------------------------------------------------- // FOR AUTOMATIC KNOWLEDGE if (currentGameMode == GameMode.AivsAi) { AIController.Get().DecideFormations(); } //----------------------------------------------------------------------------------------------------------------------------------------------- callToEnd = false; // Center the camera in the board BoardData boardData = BoardData.Get(); Vector3 boardCenterCellPosition = boardBehaviour.GetWorldPositionOfCell(boardData.GetBoardCenterCell()); cameraBehaviour.CenterToPosition(boardCenterCellPosition); // Show the hiden cells ShowCells(); uint j = 0; for ( j = 0; j < AIController.Get().GetPossibleActions().GetCount() && AIController.Get().GetPossibleActions().GetAt((uint)j) != playerController.GetPlayerFormation(); ++j ) { ; } playerController.GetPlayerFormation().Index = j; AIController.Get().OnBattleStart(); for (int i = 0; i < AITeamData.GetSoldiers().Count; ++i) { playerTeamData.GetSoldiers()[i].ApplyBuff(); AITeamData.GetSoldiers()[i].ApplyBuff(); } foreach (Soldier soldier in playerTeamData.GetSoldiers()) { soldier.SetReadyToFight(true); } foreach (Soldier soldier in AITeamData.GetSoldiers()) { soldier.SetReadyToFight(true); } }
private void HideCells() { BoardData boardData = BoardData.Get(); int maxColumns = boardData.GetColumns(); int maxRows = boardData.GetRows(); CellData firstNonPlayerCell = boardData.GetBoardCenterCell(); CellData lastCellOnBoard = boardData.GetCellDataAt(maxColumns - 1, maxRows - 1); --firstNonPlayerCell; while (firstNonPlayerCell != lastCellOnBoard) { firstNonPlayerCell.GetVisibleItem().Hide(); ++firstNonPlayerCell; } lastCellOnBoard.GetVisibleItem().Hide(); }