added Gridinfo

This commit is contained in:
j.mei7
2022-03-09 19:02:26 +01:00
parent 5a680495ce
commit 25ce88501d
7 changed files with 59 additions and 19 deletions

View File

@@ -15,9 +15,9 @@ public class GridBuildingSystem : MonoBehaviour
if (instance == null)
instance = this;
int gridWidth = 20;
int gridHeight = 20;
float cellSize = 1f;
int gridWidth = GridInfo.instance.gridWidth;
int gridHeight = GridInfo.instance.gridHeight;
float cellSize = GridInfo.instance.cellSize;
buildingGrid = new Grid<GridObject>(gridWidth, gridHeight, cellSize, Vector3.zero, (Grid<GridObject> g, int x, int y) => new GridObject(g, x, y));
placedObjectTypeSO = placedObjectTypeSOList[0];

View File

@@ -1,16 +1,4 @@
/*
------------------- Code Monkey -------------------
Thank you for downloading this package
I hope you find it useful in your projects
If you have any questions let me know
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

View File

@@ -13,9 +13,9 @@ public class Pathfinding {
private List<PathNode> openList;
private List<PathNode> closedList;
public Pathfinding(int width, int height) {
public Pathfinding(int width, int height, float cellSize) {
Instance = this;
grid = new Grid<PathNode>(width, height, 1f, Vector3.zero, (Grid<PathNode> g, int x, int y) => new PathNode(g, x, y));
grid = new Grid<PathNode>(width, height, cellSize, Vector3.zero, (Grid<PathNode> g, int x, int y) => new PathNode(g, x, y));
}
public Grid<PathNode> GetGrid() {