コード例 #1
0
ファイル: PathFind_AStar.cs プロジェクト: ChoiIngon/Rpg1994
 public Node(PathFind_AStar finder, Node parent, Position position, int path_cost)
 {
     this.finder = finder;
     this.position = position;
     this.expect_cost += Mathf.Abs(finder.destination.x - position.x);
     this.expect_cost += Mathf.Abs(finder.destination.y - position.y);
     this.path_cost = path_cost;
     this.parent = parent;
 }
コード例 #2
0
ファイル: MonsterData.cs プロジェクト: ChoiIngon/Rpg1994
 public virtual void Move()
 {
     float chaseWeight = (float)speed / Player.Instance.speed;
     if (UnityEngine.Random.Range(1, 100) < chaseWeight * 100) {
         PathFind_AStar path = new PathFind_AStar ();
         Position next = path.FindNextPath (position, Player.Instance.position);
         if (null != next) {
             Move (next);
         }
     }
     state = State.Chase;
 }