public override void HighlightTiles(Vector2Int[] tiles, AIDataType aitype) { Vector2Int[] caitiles; //in case of invalid type there in only addition, so it doesn't need to be clared afterwords if (highlighttoupdate.ContainsKey(aitype) && aitype != AIDataType.Invalid) { caitiles = highlighttoupdate[aitype]; } else { highlighttoupdate[aitype] = new Vector2Int[0]; caitiles = highlighttoupdate[aitype]; } //clearing previous texture for (int i = 0; i < caitiles.Length; i++) { highlighttmap.UpdateAt(caitiles[i], AIDataType.None); } //assign new tiles for (int i = 0; i < tiles.Length; i++) { highlighttmap.UpdateAt(tiles[i], aitype); } highlighttoupdate[aitype] = tiles; }
public void HighlightTiles(Vector2Int[] tiles, AIDataType aitype) { if (precheck) { resolutioncheck(); visual.HighlightTiles(tiles, aitype); } }
private void clearHighlightTiles() { highlighttoupdate.Clear(); AIDataType[] aitypes = new AIDataType[BoardSize.x * BoardSize.y]; for (int i = 0; i < aitypes.Length; i++) { aitypes[i] = AIDataType.None; } highlighttmap.UpdateComplete(aitypes); }
/// <summary> /// This method was used before Invalidtiles /// </summary> /// <param name="answer">Data received from AIRequestProvider.GetRequestedMinesweeperElementInfos method</param> public void AnswerProcecessor(KeyValuePair <AIDataType, KeyValuePair <Vector2Int, MinesweeperElementInfo>[]>[] answer) { for (int i = 0; i < answer.Length; i++) { AIDataType requestType = answer[i].Key; KeyValuePair <Vector2Int, MinesweeperElementInfo>[] currentanswer = answer[i].Value; for (int j = 0; j < currentanswer.Length; j++) { Vector2Int currenttile = currentanswer[j].Key; MinesweeperElementInfo currentmsei = currentanswer[j].Value; if (currentmsei.hidden) { switch (requestType) { case AIDataType.Open: { //for safety, i only allow tiles to be considered safe if they were previusly open //so here i check if they belong to 'Safe' if (NextToInvalidTile(currenttile)) { Safe.Add(currenttile); } else { Open.Add(currenttile, 0); } break; } case AIDataType.Safe: { Safe.Add(currenttile); break; } } } } } }
public abstract void HighlightTiles(Vector2Int[] tiles, AIDataType aitype);