Grid spawner gap now x and y independendt
This commit is contained in:
parent
55d2181ebd
commit
c71750a059
|
@ -6,7 +6,7 @@ using UnityEngine;
|
||||||
public class GridManager : MonoBehaviour
|
public class GridManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Vector2Int GridSize;
|
[SerializeField] private Vector2Int GridSize;
|
||||||
[SerializeField] private float Gap = 0.1f;
|
[SerializeField] private Vector2 Gap;
|
||||||
[SerializeField] private GridType gridType = GridType.Primary;
|
[SerializeField] private GridType gridType = GridType.Primary;
|
||||||
[Space(10)]
|
[Space(10)]
|
||||||
[SerializeField] private GameObject TowerSlotPrefab;
|
[SerializeField] private GameObject TowerSlotPrefab;
|
||||||
|
@ -37,7 +37,7 @@ public class GridManager : MonoBehaviour
|
||||||
for (int y = 0; y < GridSize.y; y++)
|
for (int y = 0; y < GridSize.y; y++)
|
||||||
{
|
{
|
||||||
// Spawn slot
|
// Spawn slot
|
||||||
Vector3 spawnPosition = new(x * (Gap + 1) + 0.5f, 0, y * (Gap + 1) + 0.5f);
|
Vector3 spawnPosition = new(x * (Gap.x + 1) + 0.5f, 0, y * (Gap.y + 1) + 0.5f);
|
||||||
var spawned = Instantiate(TowerSlotPrefab, transform);
|
var spawned = Instantiate(TowerSlotPrefab, transform);
|
||||||
spawned.transform.localPosition = spawnPosition;
|
spawned.transform.localPosition = spawnPosition;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue