新增MathHelper.toInt
This commit is contained in:
@@ -17,7 +17,7 @@ module es {
|
||||
res.range = this._points.length - 4;
|
||||
} else {
|
||||
t = MathHelper.clamp01(t) * this._curveCount;
|
||||
res.range = Math.floor(t);
|
||||
res.range = MathHelper.toInt(t);
|
||||
t -= res.range;
|
||||
res.range *= 3;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ module es {
|
||||
}
|
||||
|
||||
public static floorToInt(f: number) {
|
||||
return Math.trunc(Math.floor(f));
|
||||
return this.toInt(Math.floor(f));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -675,5 +675,9 @@ module es {
|
||||
public static fromAngle(angle: number) {
|
||||
return new Vector2(Math.cos(angle), Math.sin(angle)).normalizeEqual();
|
||||
}
|
||||
|
||||
public static toInt(val: number){
|
||||
return val>0 ? Math.floor(val):Math.ceil(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user