/// <summary> /// Utilization of hex mathematics to deduce general direction towards a certain tile /// </summary> /// <returns> /// A suboptimal movement dir towards closest target /// </returns> protected int ChaseDir() { List <GameCharacter> detectedEnemies = ObjectivesInSightSensor(); // Choose most desirable prey: proximity criteria if (detectedEnemies.Count <= 0) { return(-1); } Vector2Int preyPosition = ClosestObjective(detectedEnemies); HexTile currentTile = BattleMap_.mapTiles[InGamePosition]; HexTile neighbor; List <int> dirList = HexCalculator.ForwardDir(HexCalculator.GeneralDirectionTowards(this.InGamePosition, preyPosition)); for (int i = 0; i < dirList.Count; i++) { if (currentTile.Neighbors.TryGetValue(dirList[i], out neighbor)) { if (!neighbor.Occupied) { return(dirList[i]); } } } // If all are occupied, "failed chasing" return(-1); }