make it work

This commit is contained in:
yugecin
2016-11-12 18:25:55 +01:00
parent 3dc0ad8c68
commit fe2169c39c
4 changed files with 39 additions and 22 deletions

View File

@@ -22,17 +22,16 @@ import itdelatrisu.opsu.objects.GameObject;
public class DefaultSliderMoverController implements SliderMoverController {
@Override
public GameObject process(GameObject obj) {
return obj;
}
@Override
public GameObject processNext(int time) {
return null;
public GameObject[] process(GameObject p, GameObject c, int time) {
return new GameObject[] {
p,
c
};
}
@Override
public String toString() {
return "Nothing special, just follow it";
}
}

View File

@@ -17,18 +17,41 @@
*/
package yugecin.opsudance.movers.slidermovers;
import itdelatrisu.opsu.objects.Circle;
import itdelatrisu.opsu.objects.GameObject;
import itdelatrisu.opsu.objects.Slider;
public class InheritedSliderMoverController implements SliderMoverController {
@Override
public GameObject process(GameObject obj) {
return obj;
}
private GameObject currentSlider;
private Circle[] positions;
private int idx;
@Override
public GameObject processNext(int time) {
return null;
public GameObject[] process(GameObject p, GameObject c, int time) {
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

View File

@@ -21,7 +21,6 @@ import itdelatrisu.opsu.objects.GameObject;
public interface SliderMoverController {
GameObject process(GameObject obj);
GameObject processNext(int time);
GameObject[] process(GameObject p, GameObject c, int time);
}