Bomberman/Assets/Scripts/MapData.cs
2020-06-14 16:41:24 -04:00

40 lines
686 B
C#

using UnityEngine;
[CreateAssetMenu]
public class MapData : ScriptableObject {
static readonly Vector2[] AxialDirections = {
new Vector2(1, 0),
new Vector2(1, -1),
new Vector2(0, -1),
new Vector2(-1, 0),
new Vector2(-1, 1),
new Vector2(0, 1)
};
//With flat hexes
public enum Direction {
DownRight = 0,
UpRight = 1,
Up = 2,
UpLeft = 3,
DownLeft = 4,
Down = 6
}
/* With pointy hexes
enum Direction {
Right,
UpRight,
UpLeft,
Left,
DownLeft,
DownRight
}*/
/*public static Vector3 AxialToWorld(int q, int s) {
}*/
public static Vector2 GetNeighbor(Vector2 axial, Direction direction)
=> axial + AxialDirections[(int)direction];
}