private void Load() { List <TextBox> GroupsNames = Data.LoadGroupNames(); foreach (TextBox GroupName in GroupsNames) { foreach (object child in Grid1.Children) { if (child is TextBox) { if ((child as TextBox).Name == GroupName.Name) { (child as TextBox).Text = GroupName.Text; } } //thats all folks } } ShortcutItems = Data.LoadShortcuts(); foreach (ShortcutsSaveData item in ShortcutItems) { Tile parent = GetParent(item.ParentTile); item.item.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(ScrollViewer1.Background.ToString()))); parent.Add(item.item); } Data.SaveShortcuts(ShortcutItems); }
public static INamedTileCollection CreateReadonlyTileProvider(string Name, int X, int Y, int Width, int Height, ITile[,] CopyFrom, int Layer = 0) { Type newType = Helper.CreateType(); Type tileProviderType = typeof(ReadonlyTileProvider <>).MakeGenericType(newType); INamedTileCollection result = (INamedTileCollection)Activator.CreateInstance(tileProviderType, true); ((dynamic)result).Initialize(Name, X, Y, Width, Height, CopyFrom, Layer); typeof(TileReference <>) .MakeGenericType(newType) .GetField("_Provider", BindingFlags.NonPublic | BindingFlags.Static) .SetValue(null, result); typeof(ReadonlyTileReference <>) .MakeGenericType(newType) .GetField("_Provider", BindingFlags.NonPublic | BindingFlags.Static) .SetValue(null, result); lock (FakeProviderPlugin.ProvidersToAdd) { if (FakeProviderPlugin.ProvidersLoaded) { Tile.Add(result); } else { FakeProviderPlugin.ProvidersToAdd.Add(result); } } return(result); }
private bool PlaceTileIntoVoid(Tile t) { if (buttonPressed) { return(false); } if (t == currentTile || (t.StackSize >= currentTile.StackSize - 1 && t.StackSize != 0) || !Level.LegalSpot(t)) { return(false); } if (Inventory.TileIsAddon()) { return(false); } IEnumerable <Tile> item; if (!Inventory.TryGetItem(out item)) { return(false); } t.Add(item); SetInteractionActionMessage(); return(true); }
public void When_SubtileAdded_Expect_CountIncrements() { World world = new World(new MapSettings()); Tile tile = new Tile(Directions.O, null, world, 1); Tile subtile = new Tile(Directions.O, null, world, 0); Assert.That(tile.Count, Is.Zero, "Map count initialized at non-zero number."); tile.Add(subtile); Assert.That(tile.Count, Is.EqualTo(1), "Map count did not increment."); }
public void When_SubtileAdded_Expect_TileContainsSubtile() { World world = new World(new MapSettings()); Tile tile = new Tile(Directions.O, null, world, 1); Tile subtile = new Tile(Directions.O, null, world, 0); tile.Add(subtile); Assert.That(tile, Contains.Key(subtile.Coordinates), "Map does not recognize submap key."); Assert.That(tile, Contains.Value(subtile), "Map does not recognize submap value."); Assert.That(subtile, Is.SameAs(tile[subtile.Coordinates]), "Submap is not the same object as the submap inside of map."); }
private void PlaceTileOnTop(Tile t) { if (t.Static) { return; } IEnumerable <Tile> tiles; if (Inventory.TryGetItem(out tiles)) { t.Add(tiles); } SetInteractionActionMessage(); }
private void Tile_Drop(object sender, DragEventArgs e) { string[] Files = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string File in Files) { ShortcutItem shortcutitem = new ShortcutItem(File) { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor((sender as ScrollViewer).Background.ToString()))) }; if (!shortcutitem.IsThereisErrors) { Tile Tile = (sender as ScrollViewer).Content as Tile; Tile.Add(shortcutitem); ShortcutItems.Add(new ShortcutsSaveData(FindTileName(sender as ScrollViewer), shortcutitem)); } } Data.SaveShortcuts(ShortcutItems); }
public void TryRFXPDecode() { var rfxPDecode = new CodecToolSet.Core.RFXPDecode.RFXPDecode(); //Frame preFrame = GetPreviousFrame("D:\\Sandbox\\CodecInput\\test.bmp"); Frame preFrame = null; Tile DAS = Tile.FromArrays <short>(new Triplet <short[]>(new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize], new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize], new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize])); // fisrt pass Tile fisrtPass = ReadTileFromFile(@"D:\TEMP\rfxPEncodeOut0.txt"); ICodecAction rlgrSRLDecode = rfxPDecode.SubActions.SingleOrDefault(c => c.Name.Equals(Constants.PDECODE_NAME_RLGRSRLDECODE)); rlgrSRLDecode.Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.FirstPass }; QuantizationFactorsArray quant = GetProgQuantizationFactorsForChunk(ProgressiveChunk_Values.kChunk_25); ICodecAction progDeQuantization = rfxPDecode.SubActions.SingleOrDefault(c => c.Name.Equals(Constants.PDECODE_NAME_PROGRESSIVEDEQUANTIZATION)); progDeQuantization.Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = quant; ICodecAction subbandDiffing = rfxPDecode.SubActions.SingleOrDefault(c => c.Name.Equals(Constants.PDECODE_NAME_SUBBANDDIFFING)); subbandDiffing.Parameters[Constants.PARAM_NAME_PREVIOUS_FRAME] = preFrame; subbandDiffing.Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.FirstPass }; ICodecAction DeQuantization = rfxPDecode.SubActions.SingleOrDefault(c => c.Name.Equals(Constants.PDECODE_NAME_DEQUANTIZATION)); QuantizationFactorsArray quantArray = new QuantizationFactorsArray(); quantArray.quants = new QuantizationFactors[3] { DEFAULT_QUANT, DEFAULT_QUANT, DEFAULT_QUANT }; DeQuantization.Parameters[Constants.PARAM_NAME_QUANT_FACTORS_ARRAY] = quantArray; Tile[] rgbImage = rfxPDecode.DoAction(new[] { fisrtPass }); rgbImage.FirstOrDefault().GetBitmap().Save("D:\\TEMP\\rfxPDecode0.bmp"); DAS.Add(rlgrSRLDecode.Result.FirstOrDefault()); preFrame = new Frame { Tile = subbandDiffing.Result.FirstOrDefault() }; ProgressiveChunk_Values[] chunks = new[] { ProgressiveChunk_Values.kChunk_25, ProgressiveChunk_Values.kChunk_50, ProgressiveChunk_Values.kChunk_75, ProgressiveChunk_Values.kChunk_100 }; for (int i = 1; i < chunks.Length; i++) { rlgrSRLDecode.Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.UpgradePass }; subbandDiffing.Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.UpgradePass }; subbandDiffing.Parameters[Constants.PARAM_NAME_PREVIOUS_FRAME] = preFrame; rlgrSRLDecode.Parameters[Constants.PARAM_NAME_DAS] = new Frame { Tile = DAS }; rlgrSRLDecode.Parameters[Constants.PARAM_NAME_PREVIOUS_PROGRESSIVE_QUANTS] = GetProgQuantizationFactorsForChunk(chunks[i - 1]); rlgrSRLDecode.Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = GetProgQuantizationFactorsForChunk(chunks[i]); quant = GetProgQuantizationFactorsForChunk(chunks[i]); progDeQuantization.Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = quant; Tile encodedTile = ReadTileFromFile(String.Format(@"D:\TEMP\rfxPEncodeOut{0}.txt", i * 2 - 1)); Tile rawTile = ReadTileFromFile(String.Format(@"D:\TEMP\rfxPEncodeOut{0}.txt", i * 2)); rgbImage = rfxPDecode.DoAction(new[] { encodedTile, rawTile }); rgbImage.FirstOrDefault().GetBitmap().Save(String.Format("D:\\TEMP\\rfxPDecode{0}.bmp", i)); DAS.Add(rlgrSRLDecode.Result.FirstOrDefault()); preFrame = new Frame { Tile = subbandDiffing.Result.FirstOrDefault() }; } }
public void TryRFXPDecodeEachStep() { string[] codecs = new[] { "rlgrSRLDecode", "progDeQuantization", "subbandDiffing", "subbandReconstruction", "DeQuantization", "inverse-Dwt", "yuvToRGB", "rgbToImage" }; var CodecDic = new Dictionary <string, CodecToolSet.Core.RFXPDecode.RFXPDecodeBase>() { { "rlgrSRLDecode", new CodecToolSet.Core.RFXPDecode.RLGR_SRLDecode() }, { "progDeQuantization", new CodecToolSet.Core.RFXPDecode.ProgressiveDequantization() }, { "subbandDiffing", new CodecToolSet.Core.RFXPDecode.SubBandDiffing() }, { "subbandReconstruction", new CodecToolSet.Core.RFXPDecode.SubBandReconstruction() }, { "DeQuantization", new CodecToolSet.Core.RFXPDecode.DeQuantization() }, { "inverse-Dwt", new CodecToolSet.Core.RFXPDecode.InverseDWT() }, { "yuvToRGB", new CodecToolSet.Core.RFXPDecode.YUVToRGB() }, { "rgbToImage", new CodecToolSet.Core.RFXPDecode.RGBToImage() } }; foreach (var key in CodecDic.Keys) { CodecDic[key].Parameters[Constants.PARAM_NAME_QUANT_FACTORS_ARRAY] = DEFAULT_QUANT_ARRAY; CodecDic[key].Parameters[Constants.PARAM_NAME_ENTROPY_ALGORITHM] = ENTROPY_ALG; CodecDic[key].Parameters[Constants.PARAM_NAME_USE_DIFFERENCE_TILE] = DEFAULT_USE_DIFFERENCE_TILE; CodecDic[key].Parameters[Constants.PARAM_NAME_USE_REDUCE_EXTRAPOLATE] = DEFAULT_USE_REDUCE_EXTRAPOLATE; } // Frame preFrame = GetPreviousFrame("D:\\Sandbox\\CodecInput\\test.bmp"); Frame preFrame = null; Tile DAS = Tile.FromArrays <short>(new Triplet <short[]>(new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize], new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize], new short[RdpegfxTileUtils.TileSize * RdpegfxTileUtils.TileSize])); // fisrtPass Tile fisrtPass = ReadTileFromFile(@"D:\TEMP\rfxPEncodeOut0.txt"); CodecDic["rlgrSRLDecode"].Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.FirstPass }; Tile[] rlgrSRLDecodeOut = CodecDic["rlgrSRLDecode"].DoAction(new[] { fisrtPass }); DAS.Add(rlgrSRLDecodeOut.FirstOrDefault()); rlgrSRLDecodeOut.FirstOrDefault().SaveToFile("D:\\TEMP\\rlgrSRLDecodeOut0.txt"); QuantizationFactorsArray quant = GetProgQuantizationFactorsForChunk(ProgressiveChunk_Values.kChunk_25); CodecDic["progDeQuantization"].Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = quant; Tile[] progDeQuantizationOut = CodecDic["progDeQuantization"].DoAction(rlgrSRLDecodeOut); progDeQuantizationOut.FirstOrDefault().SaveToFile("D:\\TEMP\\progDeQuantizationOut0.txt"); CodecDic["subbandDiffing"].Parameters[Constants.PARAM_NAME_PREVIOUS_FRAME] = preFrame; CodecDic["subbandDiffing"].Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.FirstPass }; Tile[] subbandDiffingOut = CodecDic["subbandDiffing"].DoAction(progDeQuantizationOut); preFrame = new Frame { Tile = subbandDiffingOut.FirstOrDefault() }; subbandDiffingOut.FirstOrDefault().SaveToFile("D:\\TEMP\\subbandDiffingOut0.txt"); Tile[] subbandReconstructionOut = CodecDic["subbandReconstruction"].DoAction(subbandDiffingOut); subbandReconstructionOut.FirstOrDefault().SaveToFile("D:\\TEMP\\subbandReconstructionOut0.txt"); QuantizationFactorsArray quantArray = new QuantizationFactorsArray(); quantArray.quants = new QuantizationFactors[3] { DEFAULT_QUANT, DEFAULT_QUANT, DEFAULT_QUANT }; CodecDic["DeQuantization"].Parameters[Constants.PARAM_NAME_QUANT_FACTORS_ARRAY] = quantArray; Tile[] DeQuantizationOut = CodecDic["DeQuantization"].DoAction(subbandReconstructionOut); DeQuantizationOut.FirstOrDefault().SaveToFile("D:\\TEMP\\DeQuantizationOut0.txt"); Tile[] inverseDwtOut = CodecDic["inverse-Dwt"].DoAction(DeQuantizationOut); Tile[] yuvToRGBOut = CodecDic["yuvToRGB"].DoAction(inverseDwtOut); yuvToRGBOut.FirstOrDefault().SaveToFile("D:\\TEMP\\yuvToRGBOutOut0.txt"); Bitmap bitmap = yuvToRGBOut.FirstOrDefault().GetBitmap(); bitmap.Save("D:\\Temp\\FirstPass.bmp"); ProgressiveChunk_Values[] chunks = new[] { ProgressiveChunk_Values.kChunk_25, ProgressiveChunk_Values.kChunk_50, ProgressiveChunk_Values.kChunk_75, ProgressiveChunk_Values.kChunk_100 }; for (int i = 1; i < chunks.Length; i++) { Tile encodedTile = ReadTileFromFile(String.Format(@"D:\TEMP\rfxPEncodeOut{0}.txt", i * 2 - 1)); Tile rawTile = ReadTileFromFile(String.Format(@"D:\TEMP\rfxPEncodeOut{0}.txt", i * 2)); CodecDic["rlgrSRLDecode"].Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.UpgradePass }; CodecDic["rlgrSRLDecode"].Parameters[Constants.PARAM_NAME_DAS] = new Frame { Tile = DAS }; CodecDic["rlgrSRLDecode"].Parameters[Constants.PARAM_NAME_PREVIOUS_PROGRESSIVE_QUANTS] = GetProgQuantizationFactorsForChunk(chunks[i - 1]); CodecDic["rlgrSRLDecode"].Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = GetProgQuantizationFactorsForChunk(chunks[i]); rlgrSRLDecodeOut = CodecDic["rlgrSRLDecode"].DoAction(new[] { encodedTile, rawTile }); DAS.Add(rlgrSRLDecodeOut.FirstOrDefault()); rlgrSRLDecodeOut.FirstOrDefault().SaveToFile(String.Format("D:\\TEMP\\rlgrSRLDecodeOut{0}.txt", i)); quant = GetProgQuantizationFactorsForChunk(chunks[i]); CodecDic["progDeQuantization"].Parameters[Constants.PARAM_NAME_PROGRESSIVE_QUANTS] = quant; progDeQuantizationOut = CodecDic["progDeQuantization"].DoAction(rlgrSRLDecodeOut); progDeQuantizationOut.FirstOrDefault().SaveToFile(String.Format("D:\\TEMP\\progDeQuantizationOut{0}.txt", i)); CodecDic["subbandDiffing"].Parameters[Constants.PARAM_NAME_PREVIOUS_FRAME] = preFrame; CodecDic["subbandDiffing"].Parameters[Constants.PARAM_NAME_ENCODED_TILE_TYPE] = new CodecToolSet.Core.EncodedTileType { Type = CodecToolSet.Core.EncodedTileType.EncodedType.UpgradePass }; subbandDiffingOut = CodecDic["subbandDiffing"].DoAction(progDeQuantizationOut); preFrame = new Frame { Tile = subbandDiffingOut.FirstOrDefault() }; subbandDiffingOut.FirstOrDefault().SaveToFile(String.Format("D:\\TEMP\\subbandDiffingOut{0}.txt", i)); subbandReconstructionOut = CodecDic["subbandReconstruction"].DoAction(subbandDiffingOut); CodecDic["DeQuantization"].Parameters[Constants.PARAM_NAME_QUANT_FACTORS_ARRAY] = quantArray; DeQuantizationOut = CodecDic["DeQuantization"].DoAction(subbandReconstructionOut); inverseDwtOut = CodecDic["inverse-Dwt"].DoAction(DeQuantizationOut); yuvToRGBOut = CodecDic["yuvToRGB"].DoAction(inverseDwtOut); yuvToRGBOut.FirstOrDefault().SaveToFile(String.Format("D:\\TEMP\\yuvToRGBOutOut{0}.txt", i)); bitmap = yuvToRGBOut.FirstOrDefault().GetBitmap(); bitmap.Save(String.Format("D:\\Temp\\upgradePass{0}.bmp", i)); } }
protected override void DoCommandAction() { // reset PRIOR to reading to reset high lighter CommandExecuter.Instance.Execute(new Reset()); FPGA.FPGA.Instance.Reset(); FPGA.FPGA.Instance.BackendType = FPGATypes.BackendType.Altera; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(FileName); XmlElement xmlEl = xmlDoc.DocumentElement; Dictionary <string, XmlNode> blockTypes = new Dictionary <string, XmlNode>(); foreach (XmlAttribute attr in xmlEl.Attributes) { if (attr.Name.Equals("name")) { if (attr.Value.Equals("stratixv")) { FPGA.FPGA.Instance.Family = FPGATypes.FPGAFamily.StratixV; } else if (attr.Value.Equals("CycloneIVE")) { FPGA.FPGA.Instance.Family = FPGATypes.FPGAFamily.CycloneIVE; } else { throw new ArgumentException("Unknonwn Altera FPGA family " + attr.Value); } } } foreach (XmlNode xmlNode in xmlEl.ChildNodes) { // get block types if (xmlNode.Name.Equals("BLOCK")) { foreach (XmlAttribute attr in xmlNode.Attributes) { if (attr.Name.EndsWith("type")) { string type = attr.Value; blockTypes.Add(type, xmlNode); } else if (attr.Name.EndsWith("IS_CONTAINED")) { } else { } } } // get block instances if (xmlNode.Name.Equals("DEVICE")) { foreach (XmlAttribute attr in xmlNode.Attributes) { if (attr.Name.Equals("name")) { FPGA.FPGA.Instance.DeviceName = attr.Value; } } foreach (XmlNode instanceNode in xmlNode.ChildNodes) { if (instanceNode.Name.Equals("BLOCK_INSTANCE")) { string type = ""; foreach (XmlAttribute attr in instanceNode.Attributes) { if (attr.Name.Equals("type")) { type = attr.Value; } } // get locations foreach (XmlNode locationNode in instanceNode.ChildNodes) { int x = -1; int y = -1; int z = -1; string name = ""; foreach (XmlAttribute attr in locationNode.Attributes) { if (attr.Name.Equals("x")) { x = int.Parse(attr.Value); } if (attr.Name.Equals("y")) { y = int.Parse(attr.Value); } if (attr.Name.Equals("z")) { z = int.Parse(attr.Value); } if (attr.Name.Equals("name")) { name = attr.Value; } } TileKey key = new TileKey(x, y); Tile t = new Tile(key, name); if (!blockTypes.ContainsKey(type)) { } else { XmlNode blockTypeNode = blockTypes[type]; } //Console.WriteLine(key.ToString() + " " + name); if (FPGA.FPGA.Instance.Contains(key)) { Tile containingTile = FPGA.FPGA.Instance.GetTile(key); containingTile.Add(t); } else { FPGA.FPGA.Instance.Add(t); } } } } } } }
static World ConstructNewZealand() { World world = new World(1000, 1000); string[] regions = new string[] { "Hawkes Bay", "Auckland", "New Plymouth", "Wellington", "Nelson", "Marlborough", "Westland", "Canterbury", "Otago", "Southland" }; Random randomNumberGenerator = new Random(); for (int i = 0; i < regions.Length; i++) { string regionName = regions[i]; Region region = new Region(world); world.Regions.Add(region); int tileWidth = randomNumberGenerator.Next(2, 10); int tileHeight = randomNumberGenerator.Next(2, 10); int regionModifier = i * 10; for (int width = 0; width < tileWidth; width++) { for (int height = 0; height < tileHeight; height++) { int tileType = randomNumberGenerator.Next(0, Enum.GetValues(typeof(Tile.TileTypeEnum)).Length); int resourceType = randomNumberGenerator.Next(0, Enum.GetValues(typeof(Tile.ResourceTypeEnum)).Length); Tile tile = new Tile(regionModifier + width, regionModifier + height, (Tile.TileTypeEnum)tileType, (Tile.ResourceTypeEnum)resourceType, region); region.Add(tile); } } } Player playerOne = new Player("Player One"); world.Players.Add(playerOne); Tile tileOne = world.TileGrid[1, 1]; Army armyOne = new Army("armyOne", tileOne, playerOne); tileOne.Add(armyOne); playerOne.Armies.Add(armyOne); int regimentCount = randomNumberGenerator.Next(0, 10); for (int i = 0; i < regimentCount; i++) { Regiment regiment = new Regiment(1000, new UnitType()); armyOne.Add(regiment); } Player playerTwo = new Player("Player Two"); world.Players.Add(playerTwo); Tile tileTwo = world.TileGrid[2, 2]; Army armyTwo = new Army("armyTwo", tileOne, playerTwo); tileTwo.Add(armyTwo); playerTwo.Armies.Add(armyOne); int playerTwoRegimentCount = randomNumberGenerator.Next(0, 10); for (int i = 0; i < playerTwoRegimentCount; i++) { Regiment regiment = new Regiment(1000, new UnitType()); armyOne.Add(regiment); } return(world); }
IEnumerator Start() { // 地形データのロード. var tmx = new TMXLoader(); tmx.Load("Levels/001"); var layer = tmx.GetLayer(0); //layer.Dump(); // タイルの配置. for (int j = 0; j < layer.Height; j++) { for (int i = 0; i < layer.Width; i++) { var v = layer.Get(i, j); var x = GetChipX(i); var y = GetChipY(j); Tile.Add(v, x, y); } } yield return(new WaitForSeconds(0.1f)); var pList = new List <Point2>(); Token player = null; // A-star実行. { // スタート地点. Point2 pStart = GetRandomPosition(layer); player = Util.CreateToken(GetChipX(pStart.x), GetChipY(pStart.y), "", "miku2", "Player"); player.SortingLayer = "Chara"; // ゴール. Point2 pGoal = GetRandomPosition(layer); var goal = Util.CreateToken(GetChipX(pGoal.x), GetChipY(pGoal.y), "", "gate1", "Goal"); goal.SortingLayer = "Chara"; // 斜め移動を許可 var allowdiag = true; var mgr = new ANodeMgr(layer, pGoal.x, pGoal.y, allowdiag); // スタート地点のノード取得 // スタート地点なのでコストは「0」 ANode node = mgr.OpenNode(pStart.x, pStart.y, 0, null); mgr.AddOpenList(node); // 試行回数。1000回超えたら強制中断 int cnt = 0; while (cnt < 1000) { mgr.RemoveOpenList(node); // 周囲を開く mgr.OpenAround(node); // 最小スコアのノードを探す. node = mgr.SearchMinScoreNodeFromOpenList(); if (node == null) { // 袋小路なのでおしまい. Debug.Log("Not found path."); break; } if (node.X == pGoal.x && node.Y == pGoal.y) { // ゴールにたどり着いた. Debug.Log("Success."); mgr.RemoveOpenList(node); node.DumpRecursive(); // パスを取得する node.GetPath(pList); // 反転する pList.Reverse(); break; } yield return(new WaitForSeconds(0.01f)); } } _state = eState.Walk; // プレイヤーを移動させる. foreach (var p in pList) { var x = GetChipX(p.x); var y = GetChipY(p.y); player.X = x; player.Y = y; yield return(new WaitForSeconds(0.2f)); } // おしまい _state = eState.End; }