Latum mostly done

This commit is contained in:
Anuken
2022-02-26 13:17:39 -05:00
parent 7650226f25
commit c98db84315
13 changed files with 127 additions and 66 deletions

View File

@@ -3,6 +3,7 @@ package mindustry.entities.part;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
public abstract class DrawPart{
public static final PartParams params = new PartParams();
@@ -88,6 +89,10 @@ public abstract class DrawPart{
return p -> get(p) + amount;
}
default PartProgress add(PartProgress other){
return p -> get(p) + other.get(p);
}
default PartProgress delay(float amount){
return p -> (get(p) - amount) / (1f - amount);
}
@@ -96,6 +101,13 @@ public abstract class DrawPart{
return p -> (get(p) - offset) / duration;
}
default PartProgress sustain(float offset, float grow, float sustain){
return p -> {
float val = get(p) - offset;
return Math.min(Math.max(val, 0f) / grow, (grow + sustain + grow - val) / grow);
};
}
default PartProgress shorten(float amount){
return p -> get(p) / (1f - amount);
}
@@ -116,6 +128,10 @@ public abstract class DrawPart{
return p -> Math.min(get(p), other.get(p));
}
default PartProgress sin(float offset, float scl, float mag){
return p -> get(p) + Mathf.sin(Time.time + offset, scl, mag);
}
default PartProgress sin(float scl, float mag){
return p -> get(p) + Mathf.sin(scl, mag);
}