PartProgress.time & PartProgress.mod added (#9499)
* PartProgress.time & PartProgress.mod added * Add loop() to combine mul and mod
This commit is contained in:
@@ -85,7 +85,9 @@ public abstract class DrawPart{
|
|||||||
/** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */
|
/** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */
|
||||||
heat = p -> p.heat,
|
heat = p -> p.heat,
|
||||||
/** Lifetime fraction, 0 to 1. Only for missiles. */
|
/** Lifetime fraction, 0 to 1. Only for missiles. */
|
||||||
life = p -> p.life;
|
life = p -> p.life,
|
||||||
|
/** Current unscaled value of Time.time. */
|
||||||
|
time = p -> Time.time;
|
||||||
|
|
||||||
float get(PartParams p);
|
float get(PartParams p);
|
||||||
|
|
||||||
@@ -168,6 +170,14 @@ public abstract class DrawPart{
|
|||||||
return p -> get(p) + Mathf.absin(scl, mag);
|
return p -> get(p) + Mathf.absin(scl, mag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default PartProgress mod(float amount){
|
||||||
|
return p -> Mathf.mod(get(p), amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
default PartProgress loop(float time){
|
||||||
|
return p -> Mathf.mod(get(p)/time, 1);
|
||||||
|
}
|
||||||
|
|
||||||
default PartProgress apply(PartProgress other, PartFunc func){
|
default PartProgress apply(PartProgress other, PartFunc func){
|
||||||
return p -> func.get(get(p), other.get(p));
|
return p -> func.get(get(p), other.get(p));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user