Ejemplo n.º 1
0
        public static Matrix4x4 GetTransform(this IAIPath path, float distance)
        {
            var length   = GetLength(path);
            var progress = distance / length;

            if (path.Reverse)
            {
                progress = 1 - progress;
            }

            distance = path.PathOffsetStart + progress * length;

            var maxDistance = path.LoftPath?.Length ?? 1;

            var t    = progress;
            var lerp = Mathf.Lerp(path.SideOffsetStart, path.SideOffsetEnd, t * t * t * (t * (6f * t - 15f) + 10f));

            var m = Matrix4x4.Translate(new Vector3(lerp, 0, 0));

            var result = path.LoftPath.GetTransform(distance) * m;

            if (path.Reverse)
            {
                return(result * rotate);
            }
            return(result);
        }
Ejemplo n.º 2
0
 public static float GetPathOffset(this IAIPath path, bool end)
 {
     if (path.Reverse ^ end)
     {
         return(path.LoftPath?.Length - path.PathOffsetEnd ?? 0);
     }
     else
     {
         return(path.PathOffsetStart);
     }
 }
Ejemplo n.º 3
0
 public static float GetSideOffset(this IAIPath path, bool end)
 {
     if (path.Reverse ^ end)
     {
         return(path.SideOffsetEnd);
     }
     else
     {
         return(path.SideOffsetStart);
     }
 }
Ejemplo n.º 4
0
        public static float GetDistanceFromLoftPath(this IAIPath path, float loftpathDistance)
        {
            var nS = path.GetStartPathOffset();
            var nE = path.GetEndPathOffset();

            //n = (nE - nS) * t + nS;
            //(nE - nS) * t = n - nS
            var t = (loftpathDistance - nS) / (nE - nS);


            return(t * path.GetLength());
        }
Ejemplo n.º 5
0
		public void Play() {
			_previousFrameDistance = 100F;

			_isPlaying = true;
			_startedPlaying = false;

			if (TargetActivated != null) {
				TargetActivated.Invoke(this , new TargetActivatedEventArgs(this.transform, this.AffectCharacterRotation));
			}

			// Get the active pc
			_pathingCharacter = GameController.PartyManager.ActivePC.GetComponent<IAIPath>();

			

		}
Ejemplo n.º 6
0
 public static Matrix4x4 GetEndTransform(this IAIPath path) => path.GetTransform(path.GetLength());
Ejemplo n.º 7
0
 public static Matrix4x4 GetStartTransform(this IAIPath path) => path.GetTransform(0);
Ejemplo n.º 8
0
 public static float GetOffsetPercentual(this IAIPath path, float n)
 {
     return(Mathf.Lerp(path.GetStartPathOffset(), path.GetEndPathOffset(), n));
 }
Ejemplo n.º 9
0
 public static float GetLength(this IAIPath path) => path.LoftPath?.Length - path.PathOffsetEnd - path.PathOffsetStart ?? 0;
Ejemplo n.º 10
0
 public static float GetEndSideOffset(this IAIPath path) => GetSideOffset(path, end: true);
Ejemplo n.º 11
0
 public static float GetStartSideOffset(this IAIPath path) => GetSideOffset(path, end: false);
Ejemplo n.º 12
0
 public PathDescription(IAIPath Path, float Start, float End) : this()
 {
     this.Path  = Path;
     this.Start = Start;
     this.End   = End;
 }