package de.frajul.endlessroll.entities;

import de.frajul.endlessroll.main.GameLog;

/**
 * Created by Julian on 11.12.2016.
 */

public enum Vertex {

    UL(0, -1, 1), UR(1, 1, 1), BL(3, -1, -1), BR(2, 1, -1);

    private int index;
    private float x, y;

    Vertex(int index, float x, float y) {
        this.index = index;
        this.x = x;
        this.y = y;
    }

    public Vertex getNext(boolean clockwise) {
        int newIndex = index + 1;
        if (!clockwise)
            newIndex = index - 1;
        if (newIndex > 3)
            newIndex = 0;
        if (newIndex < 0)
            newIndex = 3;
        for (Vertex vertex : values())
            if (vertex.index == newIndex)
                return vertex;
        GameLog.e("No vertex with index " + index + " found!!!");
        return null;
    }

    public float getX() {
        return x;
    }

    public float getY() {
        return y;
    }
}
