mirror of
https://github.com/ConjureETS/Bomberman.git
synced 2026-03-24 10:20:58 +00:00
40 lines
686 B
C#
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];
|
|
} |