public SteeringAlgorithm(Targeter tag)
 {
     this.targeter = tag;
     maxConstraintSteps = 10.0f; //alterar dps consoante
     validPath = false;
     goal = new Goal();
     smoothpath = new GlobalPath();
     this.goal.updateChannels(targeter.getGoal());
 }
示例#2
0
 public GlobalPath decompose(DynamicCharacter character, Goal goal)
 {
     this.aStarPathFinding.InitializePathfindingSearch(character.KinematicData.position, goal.position);
     if (this.aStarPathFinding.InProgress)
     {
         var finished = this.aStarPathFinding.Search(out this.currentSolution, true);
         if (finished && this.currentSolution != null)
         {
             //lets smooth out the Path
             this.currentSmoothedSolution = StringPullingPathSmoothing.SmoothPath(character.KinematicData, this.currentSolution);
             currentSmoothedSolution.CalculateLocalPathsFromPathPositions(character.KinematicData.position);
             return this.currentSmoothedSolution;
         }
     }
     return null;
 }
示例#3
0
 public void updateChannels(Goal goal)
 {
     if (goal.hasPosition) this.position = goal.position;
 }
示例#4
0
 public Targeter(Goal endPosition)
 {
     this.goal = endPosition;
     this.goal.hasPosition = true;
 }