something

This commit is contained in:
Awlex
2016-11-19 22:47:27 +01:00
parent 3bd16a8593
commit a671f9dba2
4 changed files with 23 additions and 22 deletions

View File

@@ -70,8 +70,6 @@ public class ArcMover extends PolyMover {
percent = ((double) time - middle.getTime()) / (p2.getTime() - middle.getTime());
angle = beta + (gamma - beta) * percent;
}
if (angle > PI)
angle -= PI;
return new double[]{
xm + r * cos(angle),
ym + r * sin(angle)

View File

@@ -10,28 +10,29 @@ import itdelatrisu.opsu.objects.GameObject;
* Created by Awlex on 18.11.2016.
*/
public class ArcFactory implements PolyMoverFactory {
private static final int PREFFERED_BUFFER_SIZE = 3;
private PolyMover current, previous;
private int lastIndex;
public double[] getPointAt(int time) {
if (previous == null) {
return current.getPointAt(time);
} else if (current == null) {
}
if (current == null) {
return previous.getPointAt(time);
}
double[] point1 = current.getPointAt(time);
double[] point2 = previous.getPointAt(time);
return new double[]{
(point1[0] + point2[0]) * 0.5,
(point1[1] + point2[1]) * 0.5
};
}
public void init(GameObject[] objects, int startIndex) {
if (objects == null)
throw new NullPointerException("Objects musn't be null");
@@ -45,7 +46,9 @@ public class ArcFactory implements PolyMoverFactory {
startIndex++;
}
GameObject middle = objects[startIndex + 1];
if (middle.isSlider() || middle.isSpinner() || !ArcMover.canCricleExistBetweenItems(objects[startIndex], middle, objects[startIndex + 2]))
if (middle.isSlider() || middle.isSpinner())
return;
if (!ArcMover.canCricleExistBetweenItems(objects[startIndex], middle, objects[startIndex + 2]))
current = new LineMover(objects, startIndex, 3);
else
current = new ArcMover(objects[startIndex], middle, objects[startIndex + 2]);
@@ -54,10 +57,9 @@ public class ArcFactory implements PolyMoverFactory {
lastIndex--;
previous = null;
}
public void update(GameObject p) {
GameObject[] items = current.getItems();
System.out.println(items.length);
GameObject last = items[items.length - 1];
if (last != p) {
previous = current;
@@ -74,25 +76,25 @@ public class ArcFactory implements PolyMoverFactory {
}
lastIndex++;
}
@Override
public int getPrefferedBufferSize() {
return PREFFERED_BUFFER_SIZE;
}
@Override
public String toString() {
return "Arcs";
}
@Override
public boolean isInitialized() {
return current != null;
}
@Override
public int getLatestIndex() {
return lastIndex;
}
}