mirror of
https://github.com/ConjureETS/Bomberman.git
synced 2026-03-24 02:10:59 +00:00
Added MapData.cs
This commit is contained in:
parent
857e50842d
commit
dcd81c7b83
40
Assets/Scripts/MapData.cs
Normal file
40
Assets/Scripts/MapData.cs
Normal file
@ -0,0 +1,40 @@
|
||||
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];
|
||||
}
|
||||
3
Assets/Scripts/MapData.cs.meta
Normal file
3
Assets/Scripts/MapData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8cf68d353cd464eb80c3158efd44450
|
||||
timeCreated: 1592164640
|
||||
Loading…
x
Reference in New Issue
Block a user