예제 #1
0
 public void UpdateMaxGrade()
 {
     this.MaxGrade = Mathf.Abs(this.Grade); // average grade also matters for blocking
     for (int i = 0; i < this.PathCells.Count; i++)
     {
         float height1 = this.PathCells[i].cachedHeight;
         for (int j = 0; j < 3; j++)
         {
             float height2 = this.TargetDistCells[i][j].cell.cachedHeight;
             float delta   = this.TargetDistCells[i][j].dist;
             this.MaxGrade = Mathf.Max(this.MaxGrade, Mathf.Abs(PathingUtil.GetGrade(height1, height2, delta)));
         }
     }
     this.MaxGrade = Mathf.Max(this.MaxGrade, this.To.LocalGrade);
 }
예제 #2
0
        public void UpdateLocalGrade()
        {
            float centerHeight = this.cells[0].cachedHeight;

            this.LocalGrade = 0f;
            for (int i = 1; i <= 4; i++)
            {
                float height = this.cells[i].cachedHeight;
                this.LocalGrade = Mathf.Max(this.LocalGrade, Mathf.Abs(PathingUtil.GetGrade(centerHeight, height, cellDelta)));
            }
            for (int i = 5; i <= 8; i++)
            {
                float height = this.cells[i].cachedHeight;
                this.LocalGrade = Mathf.Max(this.LocalGrade, Mathf.Abs(PathingUtil.GetGrade(centerHeight, height, cellDeltaDiag)));
            }
        }
예제 #3
0
 public void UpdateGrade()
 {
     this.Grade = PathingUtil.GetGrade(this.From.GetHeight(), this.To.GetHeight(), this.Distance);
 }