make it work
This commit is contained in:
parent
3dc0ad8c68
commit
fe2169c39c
|
@ -146,6 +146,9 @@ public class Dancer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(int time, GameObject p, GameObject c) {
|
public void update(int time, GameObject p, GameObject c) {
|
||||||
|
GameObject[] e = sliderMoverController.process(p, c, time);
|
||||||
|
p = e[0];
|
||||||
|
c = e[1];
|
||||||
if (this.p != p) {
|
if (this.p != p) {
|
||||||
this.p = p;
|
this.p = p;
|
||||||
if (this.p == d) {
|
if (this.p == d) {
|
||||||
|
@ -154,7 +157,6 @@ public class Dancer {
|
||||||
c.start.set((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
c.start.set((float) spinnerStartPoint[0], (float) spinnerStartPoint[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c = sliderMoverController.process(c);
|
|
||||||
isCurrentLazySlider = false;
|
isCurrentLazySlider = false;
|
||||||
// detect lazy sliders, should work pretty good
|
// detect lazy sliders, should work pretty good
|
||||||
if (c.isSlider() && LAZY_SLIDERS && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= Circle.diameter * 0.8f) {
|
if (c.isSlider() && LAZY_SLIDERS && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= Circle.diameter * 0.8f) {
|
||||||
|
@ -175,12 +177,6 @@ public class Dancer {
|
||||||
mover = moverFactory.create(p, c, dir);
|
mover = moverFactory.create(p, c, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject next = sliderMoverController.processNext(time);
|
|
||||||
if (next != null) {
|
|
||||||
update(time, c, next);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time < c.getTime()) {
|
if (time < c.getTime()) {
|
||||||
if (!p.isSpinner() || !c.isSpinner()) {
|
if (!p.isSpinner() || !c.isSpinner()) {
|
||||||
double[] point = mover.getPointAt(time);
|
double[] point = mover.getPointAt(time);
|
||||||
|
|
|
@ -22,17 +22,16 @@ import itdelatrisu.opsu.objects.GameObject;
|
||||||
public class DefaultSliderMoverController implements SliderMoverController {
|
public class DefaultSliderMoverController implements SliderMoverController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameObject process(GameObject obj) {
|
public GameObject[] process(GameObject p, GameObject c, int time) {
|
||||||
return obj;
|
return new GameObject[] {
|
||||||
}
|
p,
|
||||||
|
c
|
||||||
@Override
|
};
|
||||||
public GameObject processNext(int time) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Nothing special, just follow it";
|
return "Nothing special, just follow it";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,18 +17,41 @@
|
||||||
*/
|
*/
|
||||||
package yugecin.opsudance.movers.slidermovers;
|
package yugecin.opsudance.movers.slidermovers;
|
||||||
|
|
||||||
|
import itdelatrisu.opsu.objects.Circle;
|
||||||
import itdelatrisu.opsu.objects.GameObject;
|
import itdelatrisu.opsu.objects.GameObject;
|
||||||
|
import itdelatrisu.opsu.objects.Slider;
|
||||||
|
|
||||||
public class InheritedSliderMoverController implements SliderMoverController {
|
public class InheritedSliderMoverController implements SliderMoverController {
|
||||||
|
|
||||||
@Override
|
private GameObject currentSlider;
|
||||||
public GameObject process(GameObject obj) {
|
private Circle[] positions;
|
||||||
return obj;
|
private int idx;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameObject processNext(int time) {
|
public GameObject[] process(GameObject p, GameObject c, int time) {
|
||||||
return null;
|
GameObject[] ret = new GameObject[2];
|
||||||
|
if (!c.isSlider()) {
|
||||||
|
ret[0] = p;
|
||||||
|
ret[1] = c;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if (currentSlider != c) {
|
||||||
|
currentSlider = c;
|
||||||
|
positions = ((Slider) c).getTickPositionCircles();
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
for (; idx < positions.length; idx++) {
|
||||||
|
if (time < positions[idx].getTime() || idx == positions.length - 1) {
|
||||||
|
ret[1] = positions[idx];
|
||||||
|
if (idx == 0) {
|
||||||
|
ret[0] = p;
|
||||||
|
} else {
|
||||||
|
ret[0] = positions[idx - 1];
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null; // make the compiler happy c:
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,7 +21,6 @@ import itdelatrisu.opsu.objects.GameObject;
|
||||||
|
|
||||||
public interface SliderMoverController {
|
public interface SliderMoverController {
|
||||||
|
|
||||||
GameObject process(GameObject obj);
|
GameObject[] process(GameObject p, GameObject c, int time);
|
||||||
GameObject processNext(int time);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user