コード例 #1
0
    public void WorkThreadFunction(object ThreadIndex)
    {
        Debug.Log("  Thread make Over");


        astar_algorithm = new Astar();

        Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].finished_AStar = false;



        Start_Index_I = Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].Start_E_I;
        Start_Index_J = Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].Start_E_J;

        End_Index_I = Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].End_E_I;
        End_Index_J = Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].End_E_J;


        Game_Controller.Instance.indexingEnemies[(int)ThreadIndex].foundPath = astar_algorithm.FindPathActual(Game_Controller.Instance.data.rows[Start_Index_I].col[Start_Index_J],

                                                                                                              Game_Controller.Instance.data.rows[End_Index_I].col[End_Index_J]
                                                                                                              );

        //System.Threading.Thread.Sleep(2000);
        Game_Controller.Instance.indexingEnemies [(int)ThreadIndex].finished_AStar = true;

        Debug.Log("  Thread make Over end");
    }
コード例 #2
0
 public void TestPath()
 {
     TestResult = Astar.FindPathActual(TestStart, TestEnd);
     foreach (var item in TestResult)
     {
         item.gameObject.AddComponent <SpriteRenderer>().sprite = testSprite;
     }
 }
コード例 #3
0
 public void Move(Cell start, Cell destination)
 {
     if (!start || !destination)
     {
         ColorizeLog.MoeenLog("start or end cant be null", ColorizeLog.Colors.DarkRed); return;
     }
     MyPath           = Astar.FindPathActual(start, destination);
     CurrentState     = MovementState;
     CurrentMoveIndex = 0;
 }