本文整理汇总了C#中ModifierData类的典型用法代码示例。如果您正苦于以下问题:C# ModifierData类的具体用法?C# ModifierData怎么用?C# ModifierData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModifierData类属于命名空间,在下文中一共展示了ModifierData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Apply
public override void Apply(Path p, ModifierData source)
{
Node[] path = p.path;
Vector3[] vectorPath = p.vectorPath;
if (path == null || path.Length == 0 || vectorPath == null || vectorPath.Length != path.Length) {
return;
}
//The graph index for the current nodes
int currentGraphIndex = path[0].graphIndex;
//First node which is in the graph currentGraphIndex
int currentGraphStart = 0;
List<Vector3> funnelPath = new List<Vector3> ();
List<Vector3> left = new List<Vector3> ();
List<Vector3> right = new List<Vector3> ();
for (int i=0;i<path.Length;i++) {
if (path[i].graphIndex != currentGraphIndex) {
IFunnelGraph funnelGraph = AstarData.GetGraph (path[currentGraphStart]) as IFunnelGraph;
if (funnelGraph == null) {
//Debug.Log ("Funnel Graph is null");
for (int j=currentGraphStart;j<=i;j++) {
funnelPath.Add ((Vector3)path[j].position);
}
} else {
ConstructFunnel (funnelGraph, vectorPath,path,currentGraphStart,i-1,funnelPath,left,right);
}
currentGraphIndex = path[i].graphIndex;
currentGraphStart = i;
}
}
IFunnelGraph funnelGraph2 = AstarData.GetGraph (path[currentGraphStart]) as IFunnelGraph;
if (funnelGraph2 == null) {
for (int j=currentGraphStart;j<path.Length-1;j++) {
funnelPath.Add ((Vector3)path[j].position);
}
} else {
ConstructFunnel (funnelGraph2, vectorPath,path,currentGraphStart,path.Length-1,funnelPath,left,right);
}
p.vectorPath = funnelPath.ToArray ();
#if DEBUG
for (int i=0;i<p.vectorPath.Length-1;i++) {
Debug.DrawLine (p.vectorPath[i]+Vector3.up,p.vectorPath[i+1]+Vector3.up,Color.magenta);
}
#endif
}
开发者ID:Anaryu,项目名称:aetherion,代码行数:57,代码来源:FunnelModifier.cs
示例2: Apply
public override void Apply (Path p, ModifierData source) {
lock (lockObject) {
toBeApplied = p.path;
//AstarPath.active.RegisterCanUpdateGraphs (ApplyNow);
if (!waitingForApply) {
waitingForApply = true;
AstarPath.OnPathPreSearch += ApplyNow;
}
}
}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:11,代码来源:AlternativePath.cs
示例3: Apply
public override void Apply (Path p, ModifierData source) {
List<GraphNode> path = p.path;
List<Vector3> vectorPath = p.vectorPath;
if (path == null || path.Count == 0 || vectorPath == null || vectorPath.Count != path.Count) {
return;
}
List<Vector3> funnelPath = ListPool<Vector3>.Claim ();
// Claim temporary lists and try to find lists with a high capacity
List<Vector3> left = ListPool<Vector3>.Claim (path.Count+1);
List<Vector3> right = ListPool<Vector3>.Claim (path.Count+1);
AstarProfiler.StartProfile ("Construct Funnel");
// Enqueue start point
left.Add (vectorPath[0]);
right.Add (vectorPath[0]);
// Loop through all nodes in the path (except the last one)
for (int i=0;i<path.Count-1;i++) {
// Get the portal between path[i] and path[i+1] and add it to the left and right lists
bool portalWasAdded = path[i].GetPortal (path[i+1], left, right, false);
if (!portalWasAdded) {
// Fallback, just use the positions of the nodes
left.Add ((Vector3)path[i].position);
right.Add ((Vector3)path[i].position);
left.Add ((Vector3)path[i+1].position);
right.Add ((Vector3)path[i+1].position);
}
}
// Enqueue end point
left.Add (vectorPath[vectorPath.Count-1]);
right.Add (vectorPath[vectorPath.Count-1]);
if (!RunFunnel (left,right,funnelPath)) {
// If funnel algorithm failed, degrade to simple line
funnelPath.Add (vectorPath[0]);
funnelPath.Add (vectorPath[vectorPath.Count-1]);
}
// Release lists back to the pool
ListPool<Vector3>.Release (p.vectorPath);
p.vectorPath = funnelPath;
ListPool<Vector3>.Release (left);
ListPool<Vector3>.Release (right);
}
开发者ID:luukholleman,项目名称:Airchitect,代码行数:52,代码来源:FunnelModifier.cs
示例4: Apply
public override void Apply (Path p, ModifierData source) {
if (this == null) return;
lock (lockObject) {
toBeApplied = p.path.ToArray();
if (!waitingForApply) {
waitingForApply = true;
AstarPath.OnPathPreSearch += ApplyNow;
}
}
}
开发者ID:JtheSpaceC,项目名称:Breaking-The-Rules,代码行数:13,代码来源:AlternativePath.cs
示例5: Apply
public override void Apply (Path p, ModifierData source) {
var path = p.path;
var vectorPath = p.vectorPath;
if (path == null || path.Count == 0 || vectorPath == null || vectorPath.Count != path.Count) {
return;
}
var funnelPath = ListPool<Vector3>.Claim ();
//Claim temporary lists and try to find lists with a high capacity
var left = ListPool<Vector3>.Claim (path.Count+1);
var right = ListPool<Vector3>.Claim (path.Count+1);
AstarProfiler.StartProfile ("Construct Funnel");
left.Add (vectorPath[0]);
right.Add (vectorPath[0]);
for (var i=0;i<path.Count-1;i++) {
var a = path[i].GetPortal (path[i+1], left, right, false);
var b = false;//path[i+1].GetPortal (path[i], right, left, true);
if (!a && !b) {
left.Add ((Vector3)path[i].position);
right.Add ((Vector3)path[i].position);
left.Add ((Vector3)path[i+1].position);
right.Add ((Vector3)path[i+1].position);
}
}
left.Add (vectorPath[vectorPath.Count-1]);
right.Add (vectorPath[vectorPath.Count-1]);
if (!RunFunnel (left,right,funnelPath)) {
//If funnel algorithm failed, degrade to simple line
funnelPath.Add (vectorPath[0]);
funnelPath.Add (vectorPath[vectorPath.Count-1]);
}
ListPool<Vector3>.Release (p.vectorPath);
p.vectorPath = funnelPath;
ListPool<Vector3>.Release (left);
ListPool<Vector3>.Release (right);
}
开发者ID:Marchys,项目名称:fanalet,代码行数:47,代码来源:FunnelModifier.cs
示例6: Apply
public override void Apply(Path p, ModifierData source)
{
if (this == null)
{
return;
}
object obj = this.lockObject;
lock (obj)
{
this.toBeApplied = p.path.ToArray();
if (!this.waitingForApply)
{
this.waitingForApply = true;
AstarPath.OnPathPreSearch = (OnPathDelegate)Delegate.Combine(AstarPath.OnPathPreSearch, new OnPathDelegate(this.ApplyNow));
}
}
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:17,代码来源:AlternativePath.cs
示例7: Apply
public override void Apply (Path p, ModifierData source) {
//This should never trigger unless some other modifier has messed stuff up
if (p.vectorPath == null) {
Debug.LogWarning ("Can't process NULL path (has another modifier logged an error?)");
return;
}
Vector3[] path = p.vectorPath;
switch (smoothType) {
case SmoothType.Simple:
p.vectorPath = SmoothSimple (path); break;
case SmoothType.Bezier:
p.vectorPath = SmoothBezier (path); break;
case SmoothType.OffsetSimple:
p.vectorPath = SmoothOffsetSimple (path); break;
case SmoothType.CurvedNonuniform:
p.vectorPath = CurvedNonuniform (path); break;
}
}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:21,代码来源:SimpleSmoothModifier.cs
示例8: CanConvertTo
public static ModifierData CanConvertTo(ModifierData a)
{
if (a == ModifierData.All)
{
return ModifierData.All;
}
ModifierData modifierData = a;
if (ModifierConverter.AnyBits(a, ModifierData.Nodes))
{
modifierData |= ModifierData.VectorPath;
}
if (ModifierConverter.AnyBits(a, ModifierData.StrictNodePath))
{
modifierData |= ModifierData.StrictVectorPath;
}
if (ModifierConverter.AnyBits(a, ModifierData.StrictVectorPath))
{
modifierData |= ModifierData.VectorPath;
}
return modifierData;
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:21,代码来源:ModifierConverter.cs
示例9: Convert
public static ModifierData Convert(Path p, ModifierData input, ModifierData output)
{
if (!ModifierConverter.CanConvert(input, output))
{
Debug.LogError(string.Concat(new object[]
{
"Can't convert ",
input,
" to ",
output
}));
return ModifierData.None;
}
if (ModifierConverter.AnyBits(input, output))
{
return input;
}
if (ModifierConverter.AnyBits(input, ModifierData.Nodes) && ModifierConverter.AnyBits(output, ModifierData.Vector))
{
p.vectorPath.Clear();
for (int i = 0; i < p.vectorPath.Count; i++)
{
p.vectorPath.Add((Vector3)p.path[i].position);
}
return ModifierData.VectorPath | ((!ModifierConverter.AnyBits(input, ModifierData.StrictNodePath)) ? ModifierData.None : ModifierData.StrictVectorPath);
}
Debug.LogError(string.Concat(new object[]
{
"This part should not be reached - Error in ModifierConverted\nInput: ",
input,
" (",
(int)input,
")\nOutput: ",
output,
" (",
(int)output,
")"
}));
return ModifierData.None;
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:40,代码来源:ModifierConverter.cs
示例10: Convert
/** Converts a path from \a input to \a output */
public static ModifierData Convert (Path p, ModifierData input, ModifierData output) {
//"Input" can not be converted to "output", log error
if (!CanConvert (input,output)) {
Debug.LogError ("Can't convert "+input+" to "+output);
return ModifierData.None;
}
//"Output" can take "input" with no change, return
if (AnyBits (input,output)) {
return input;
}
//If input is a node path, and output wants a vector array, convert the node array to a vector array
if (AnyBits (input,ModifierData.Nodes) && AnyBits (output, ModifierData.Vector)) {
p.vectorPath.Clear();
for (var i=0;i<p.vectorPath.Count;i++) {
p.vectorPath.Add ((Vector3)p.path[i].position);
}
//Return VectorPath and also StrictVectorPath if input has StrictNodePath set
return ModifierData.VectorPath | (AnyBits (input, ModifierData.StrictNodePath) ? ModifierData.StrictVectorPath : ModifierData.None);
}
Debug.LogError ("This part should not be reached - Error in ModifierConverted\nInput: "+input+" ("+(int)input+")\nOutput: "+output+" ("+(int)output+")");
return ModifierData.None;
}
开发者ID:Marchys,项目名称:fanalet,代码行数:28,代码来源:Modifiers.cs
示例11: AnyBits
/** Returns If \a a and \a b has any bits in common */
public static bool AnyBits (ModifierData a, ModifierData b) {
return (a & b) != 0;
}
开发者ID:Marchys,项目名称:fanalet,代码行数:4,代码来源:Modifiers.cs
示例12: AllBits
/** Returns If \a a has all bits that \a b has set to true, also set to true */
public static bool AllBits (ModifierData a, ModifierData b) {
return (a & b) == b;
}
开发者ID:Marchys,项目名称:fanalet,代码行数:4,代码来源:Modifiers.cs
示例13: Apply
/** Main Post-Processing function */
public abstract void Apply (Path p, ModifierData source);
开发者ID:Marchys,项目名称:fanalet,代码行数:2,代码来源:Modifiers.cs
示例14: GetClampedPoint
/*public override void ApplyOriginal (Path p) {
if (exactStartPoint) {
pStart = GetClampedPoint (p.path[0].position, p.originalStartPoint, p.path[0]);
if (!addPoints) {
p.startPoint = pStart;
}
}
if (exactEndPoint) {
pEnd = GetClampedPoint (p.path[p.path.Length-1].position, p.originalEndPoint, p.path[p.path.Length-1]);
if (!addPoints) {
p.endPoint = pEnd;
}
}
}*/
public override void Apply (Path _p, ModifierData source) {
ABPath p = _p as ABPath;
//Only for ABPaths
if (p == null) return;
if (p.vectorPath.Count == 0) {
return;
} else if (p.vectorPath.Count < 2 && !addPoints) {
//Vector3[] arr = new Vector3[2];
//arr[0] = p.vectorPath[0];
//arr[1] = p.vectorPath[0];
//p.vectorPath = arr;
p.vectorPath.Add (p.vectorPath[0]);
}
//Debug.DrawRay (p.originalEndPoint,Vector3.up,Color.red);
//Debug.DrawRay (p.startPoint,Vector3.up,Color.red);
//Debug.DrawRay (p.endPoint,Vector3.up,Color.green);
Vector3 pStart = Vector3.zero,
pEnd = Vector3.zero;
if (exactStartPoint == Exactness.Original) {
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.originalStartPoint, p.path[0]);
} else if (exactStartPoint == Exactness.ClosestOnNode) {
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.startPoint, p.path[0]);
} else if (exactStartPoint == Exactness.Interpolate) {
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.originalStartPoint, p.path[0]);
pStart = Mathfx.NearestPointStrict ((Vector3)p.path[0].position,(Vector3)p.path[1>=p.path.Count?0:1].position,pStart);
} else {
pStart = (Vector3)p.path[0].position;
}
if (exactEndPoint == Exactness.Original) {
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.originalEndPoint, p.path[p.path.Count-1]);
} else if (exactEndPoint == Exactness.ClosestOnNode) {
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.endPoint, p.path[p.path.Count-1]);
} else if (exactEndPoint == Exactness.Interpolate) {
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.originalEndPoint, p.path[p.path.Count-1]);
pEnd = Mathfx.NearestPointStrict ((Vector3)p.path[p.path.Count-1].position,(Vector3)p.path[p.path.Count-2<0?0:p.path.Count-2].position,pEnd);
} else {
pEnd = (Vector3)p.path[p.path.Count-1].position;
}
if (!addPoints) {
//p.vectorPath[0] = p.startPoint;
//p.vectorPath[p.vectorPath.Length-1] = p.endPoint;
//Debug.DrawLine (p.vectorPath[0],pStart,Color.green);
//Debug.DrawLine (p.vectorPath[p.vectorPath.Length-1],pEnd,Color.green);
p.vectorPath[0] = pStart;
p.vectorPath[p.vectorPath.Count-1] = pEnd;
} else {
//Vector3[] newPath = new Vector3[p.vectorPath.Length+(exactStartPoint != Exactness.SnapToNode ? 1 : 0) + (exactEndPoint != Exactness.SnapToNode ? 1 : 0)];
if (exactStartPoint != Exactness.SnapToNode) {
//newPath[0] = pStart;
p.vectorPath.Insert (0,pStart);
}
if (exactEndPoint != Exactness.SnapToNode) {
//newPath[newPath.Length-1] = pEnd;
p.vectorPath.Add (pEnd);
}
/*int offset = exactStartPoint != Exactness.SnapToNode ? 1 : 0;
for (int i=0;i<p.vectorPath.Length;i++) {
newPath[i+offset] = p.vectorPath[i];
}
p.vectorPath = newPath;*/
}
}
开发者ID:JustSAT,项目名称:Tower-Defence,代码行数:97,代码来源:StartEndModifier.cs
示例15: Apply
public override void Apply (Path p, ModifierData source) {
//This should never trigger unless some other modifier has messed stuff up
if (p.vectorPath == null) {
Debug.LogWarning ("Can't process NULL path (has another modifier logged an error?)");
return;
}
List<Vector3> path = null;
switch (smoothType) {
case SmoothType.Simple:
path = SmoothSimple (p.vectorPath); break;
case SmoothType.Bezier:
path = SmoothBezier (p.vectorPath); break;
case SmoothType.OffsetSimple:
path = SmoothOffsetSimple (p.vectorPath); break;
case SmoothType.CurvedNonuniform:
path = CurvedNonuniform (p.vectorPath); break;
}
if (path != p.vectorPath) {
ListPool<Vector3>.Release (p.vectorPath);
p.vectorPath = path;
}
//.vectorPath.Clear ();
//p.vectorPath.AddRange (path);
}
开发者ID:moderndelta137,项目名称:Shadow_Sword,代码行数:28,代码来源:SimpleSmoothModifier.cs
示例16: Apply
public override void Apply (Path p, ModifierData source) {
//System.DateTime startTime = System.DateTime.UtcNow;
if (iterations <= 0) {
return;
}
if (nodes == null) {
nodes = new List<Vector3> (p.vectorPath.Count);
} else {
nodes.Clear ();
}
nodes.AddRange (p.vectorPath);
// = new List<Vector3> (p.vectorPath);
for (int it=0;it<iterations;it++) {
if (subdivideEveryIter && it != 0) {
if (nodes.Capacity < nodes.Count*3) {
nodes.Capacity = nodes.Count*3;
}
int preLength = nodes.Count;
for (int j=0;j<preLength-1;j++) {
nodes.Add (Vector3.zero);
nodes.Add (Vector3.zero);
}
for (int j=preLength-1;j > 0;j--) {
Vector3 p1 = nodes[j];
Vector3 p2 = nodes[j+1];
nodes[j*3] = nodes[j];
if (j != preLength-1) {
nodes[j*3+1] = Vector3.Lerp (p1,p2,0.33F);
nodes[j*3+2] = Vector3.Lerp (p1,p2,0.66F);
}
}
}
int i = 0;
while (i < nodes.Count-2) {
Vector3 start = nodes[i];
Vector3 end = nodes[i+2];
/*if (i == 0 && exactStartAndEnd) {
if (overrideClampedExacts) {
start = p.originalStartPoint;
} else {
start = p.startPoint;
}
}
if (i == nodes.Count-3 && exactStartAndEnd) {
if (overrideClampedExacts) {
end = p.originalEndPoint;
} else {
end = p.endPoint;
}
}*/
//if (ValidateLine (nodes[i],nodes[i+2],start,end)) {
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch ();
watch.Start ();
if (ValidateLine (null,null,start,end)) {
//Debug.Log ("+++ Simplified "+i+" +++");
//Debug.DrawLine (start+raycastOffset,end+raycastOffset,new Color (1,0,0.5F));
nodes.RemoveAt (i+1);
//i++;
} else {
//Debug.DrawLine (start,end,Color.red);
i++;
}
watch.Stop ();
//Debug.Log ("Validate Line Took "+(watch.ElapsedTicks * 0.0001) +" Magnitude: "+(start-end).magnitude);
}
}
//ValidateLine (null,null,nodes[0],nodes[nodes.Count-1]);
p.vectorPath.Clear ();
p.vectorPath.AddRange (nodes);
//System.DateTime endTime2 = System.DateTime.UtcNow;
//float theTime2 = (endTime2-startTime).Ticks*0.0001F;
//Debug.Log ("Raycast Modifier : Time "+theTime2.ToString ("0.00"));
/*p.vectorPath = new Vector3[p.path.Length];
for (int i=0;i<p.path.Length;i++) {
//.........这里部分代码省略.........
开发者ID:Gapti,项目名称:ClashOfClanRIP,代码行数:101,代码来源:RaycastModifier.cs
示例17: CanConvert
public static bool CanConvert(ModifierData input, ModifierData output)
{
ModifierData b = ModifierConverter.CanConvertTo(input);
return ModifierConverter.AnyBits(output, b);
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:5,代码来源:ModifierConverter.cs
示例18: Apply
public override void Apply (Path _p, ModifierData source) {
var p = _p as ABPath;
//Only for ABPaths
if (p == null) return;
if (p.vectorPath.Count == 0) {
return;
}
if (p.vectorPath.Count == 1 && !addPoints) {
// Duplicate first point
p.vectorPath.Add (p.vectorPath[0]);
}
Vector3 pStart = Vector3.zero;
Vector3 pEnd = Vector3.zero;
switch(exactStartPoint) {
case Exactness.Original:
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.originalStartPoint, p.path[0]);
break;
case Exactness.ClosestOnNode:
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.startPoint, p.path[0]);
break;
case Exactness.SnapToNode:
pStart = (Vector3)p.path[0].position;
break;
case Exactness.Interpolate:
pStart = GetClampedPoint ((Vector3)p.path[0].position, p.originalStartPoint, p.path[0]);
pStart = AstarMath.NearestPointStrict ((Vector3)p.path[0].position,(Vector3)p.path[1>=p.path.Count?0:1].position,pStart);
break;
}
switch(exactEndPoint) {
case Exactness.Original:
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.originalEndPoint, p.path[p.path.Count-1]);
break;
case Exactness.ClosestOnNode:
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.endPoint, p.path[p.path.Count-1]);
break;
case Exactness.SnapToNode:
pEnd = (Vector3)p.path[p.path.Count-1].position;
break;
case Exactness.Interpolate:
pEnd = GetClampedPoint ((Vector3)p.path[p.path.Count-1].position, p.originalEndPoint, p.path[p.path.Count-1]);
pEnd = AstarMath.NearestPointStrict ((Vector3)p.path[p.path.Count-1].position,(Vector3)p.path[p.path.Count-2<0?0:p.path.Count-2].position,pEnd);
break;
}
if (!addPoints) {
p.vectorPath[0] = pStart;
p.vectorPath[p.vectorPath.Count-1] = pEnd;
} else {
if (exactStartPoint != Exactness.SnapToNode) {
p.vectorPath.Insert (0,pStart);
}
if (exactEndPoint != Exactness.SnapToNode) {
p.vectorPath.Add (pEnd);
}
}
}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:65,代码来源:StartEndModifier.cs
示例19: CanConvert
/** Returns If \a input can be converted to \a output */
public static bool CanConvert (ModifierData input, ModifierData output) {
var convert = CanConvertTo (input);
return AnyBits (output,convert);
}
开发者ID:Marchys,项目名称:fanalet,代码行数:5,代码来源:Modifiers.cs
示例20: GetClampedPoint
/*public override void ApplyOriginal (Path p) {
if (exactStartPoint) {
pStart = GetClampedPoint (p.path[0].position, p.originalStartPoint, p.path[0]);
if (!addPoints) {
p.startPoint = pStart;
}
}
if (exactEndPoint) {
pEnd = GetClampedPoint (p.path[p.path.Length-1].position, p.originalEndPoint, p.path[p.path.Length-1]);
if (!addPoints) {
p.endPoint = pEnd;
}
}
}*/
public override void Apply (Path p, ModifierData source) {
if (p.vectorPath.Length == 0) {
return;
} else if (p.vectorPath.Length < 2 && !addPoints) {
Vector3[] arr = new Vector3[2];
arr[0] = p.vectorPath[0];
arr[1] = p.vectorPath[0];
p.vectorPath = arr;
}
Vector3 pStart = Vector3.zero,
pEnd = Vector3.zero;
if (exactStartPoint == Exactness.Exact) {
pStart = GetClampedPoint (p.path[0].position, p.originalStartPoint, p.path[0]);
} else if (exactStartPoint == Exactness.Interpolate) {
pStart = GetClampedPoint (p.path[0].position, p.originalStartPoint, p.path[0]);
pStart = Mathfx.NearestPointStrict (p.path[0].position,p.path[1>=p.path.Length?0:1].position,pStart);
} else {
pStart = p.path[0].position;
}
if (exactEndPoint == Exactness.Exact) {
pEnd = GetClampedPoint (p.path[p.path.Length-1].position, p.originalEndPoint, p.path[p.path.Length-1]);
} else if (exactEndPoint == Exactness.Interpolate) {
pEnd = GetClampedPoint (p.path[p.path.Length-1].position, p.originalEndPoint, p.path[p.path.Length-1]);
pEnd = Mathfx.NearestPointStrict (p.path[p.path.Length-1].position,p.path[p.path.Length-2<0?0:p.path.Length-2].position,pEnd);
} else {
pEnd = p.path[p.path.Length-1].position;
}
if (!addPoints) {
//p.vectorPath[0] = p.startPoint;
//p.vectorPath[p.vectorPath.Length-1] = p.endPoint;
//Debug.DrawLine (p.vectorPath[0],pStart,Color.green);
//Debug.DrawLine (p.vectorPath[p.vectorPath.Length-1],pEnd,Color.green);
p.vectorPath[0] = pStart;
p.vectorPath[p.vectorPath.Length-1] = pEnd;
} else {
Vector3[] newPath = new Vector3[p.vectorPath.Length+(exactStartPoint != Exactness.Snapped ? 1 : 0) + (exactEndPoint != Exactness.Snapped ? 1 : 0)];
if (exactEndPoint != Exactness.Snapped) {
newPath[0] = pStart;
}
if (exactEndPoint != Exactness.Snapped) {
newPath[newPath.Length-1] = pEnd;
}
int offset = exactStartPoint != Exactness.Snapped ? 1 : 0;
for (int i=0;i<p.vectorPath.Length;i++) {
newPath[i+offset] = p.vectorPath[i];
}
p.vectorPath = newPath;
}
}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:80,代码来源:StartEndModifier.cs
注:本文中的ModifierData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论