private ClueData.RowCol AIChooseSpot() { List <CharacterResourceManager.Cards> targetRooms = new List <CharacterResourceManager.Cards>(); foreach (CharacterResourceManager.Cards room in CharacterResourceManager.Rooms) { if (!ClueData.Instance.HasPlayerSeenCard(room, turnManager.CurrentTurn - 1)) { targetRooms.Add(room); } } List <ClueData.RowCol> tiles = new List <ClueData.RowCol>(); foreach (GameObject tile in highlights) { ClueData.RowCol tilePos = tile.GetComponent <TileSelector>().location; if (IsEntrance(tilePos)) { CharacterResourceManager.Cards room = GetEntranceRoom(tilePos); if (targetRooms.Contains(room)) { return(tilePos); } } tiles.Add(tilePos); } return(tiles[UnityEngine.Random.Range(0, tiles.Count - 1)]); }
public bool IsEntrance(ClueData.RowCol rowCol) { bool found = false; for (int i = 0; i < entrances.Length && !found; i++) { found = (rowCol.row == entrances[i].row && rowCol.col == entrances[i].col); } return(found); }
public void SelectTile(ClueData.RowCol pos) { if (!isSelected) { RemoveHighlights(); targetPosition = boardManager.RowColToBoardLocation(pos.row, pos.col); ClueData.Instance.SetPlayerLocation(pos, turnManager.CurrentTurn - 1); isSelected = true; isMoving = true; } }
private void HighlightSpots() { ClueData.RowCol pos = ClueData.Instance.GetPlayerRowCol(turnManager.CurrentTurn - 1); List <int[]> positions = PossibleBoardLocations.GetBoardLocations(pos.row, pos.col, diceRoller.DiceValue, (i => IsValid(i))); for (int i = 0; i < positions.Count; i++) { Vector3 spawn = boardManager.RowColToBoardLocation(positions[i][0], positions[i][1], 5e-4f); GameObject tile = Instantiate(highlight, spawn, Quaternion.identity); tile.GetComponent <TileSelector>().cgm = this; tile.GetComponent <TileSelector>().location = ClueData.GetRowColl(positions[i]); tile.GetComponent <TileSelector>().clickable = IsCurrentTurnHuman(); highlights.Push(tile); } }
public bool IsValid(ClueData.RowCol rowCol) { if (rowCol.row <= 0 || rowCol.row >= boardManager.numRows - 1 || rowCol.col <= 0 || rowCol.col >= boardManager.numCols - 1) { return(IsEntrance(rowCol)); } for (int i = 0; i < excludedLocations.Length; i++) { if (rowCol.row == excludedLocations[i].row && rowCol.col == excludedLocations[i].col) { return(false); } } return(true); }
private CharacterResourceManager.Cards GetEntranceRoom(ClueData.RowCol rowCol) { if (!IsEntrance(rowCol)) { throw new Exception("Not an entrance"); } foreach (RoomEntrance roomEntrance in roomEntracnes) { foreach (ClueData.RowCol entrance in roomEntrance.entrances) { if (rowCol.row == entrance.row && rowCol.col == entrance.col) { return(roomEntrance.room); } } } throw new Exception("not found"); }