Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hexHeight = size * 2;
- hexVertDistance = hexHeight * 3 / 4;
- hexWidth = Mathf.Sqrt(3) / 2 * hexHeight;
- hexHorizDistance = hexWidth;
- void Start()
- {
- position = HexOffset((int)locationInArray.x,(int)locationInArray.y);
- transform.position = new Vector3(position.x, position.y);
- }
- public Vector2 HexOffset(int x, int y)
- {
- Vector2 position = Vector2.zero;
- if (y % 2 == 0)
- {
- position.x = x * hexHorizDistance;
- position.y = y * hexVertDistance;
- }
- else
- {
- position.x = (x + 0.5f) * hexHorizDistance;
- position.y = y * hexVertDistance;
- }
- return position;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement