mirror of
https://github.com/DerTyp7/industrialize-unity.git
synced 2025-10-30 21:07:11 +01:00
conveyorPO
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Grid<TGridObject>
|
||||
@@ -47,6 +48,32 @@ public class Grid<TGridObject>
|
||||
|
||||
}
|
||||
|
||||
public List<TGridObject> GetGridObjectsAround(Vector3 position)
|
||||
{
|
||||
List<TGridObject> gridObjects = new List<TGridObject>();
|
||||
|
||||
GetXY(position, out int x, out int y);
|
||||
|
||||
if (x - 1 >= 0)
|
||||
{
|
||||
gridObjects.Add(gridArray[x - 1, y]);
|
||||
}
|
||||
if (x + 1 < width)
|
||||
{
|
||||
gridObjects.Add(gridArray[x + 1, y]);
|
||||
}
|
||||
if (y - 1 >= 0)
|
||||
{
|
||||
gridObjects.Add(gridArray[x, y - 1]);
|
||||
}
|
||||
if (y + 1 < height)
|
||||
{
|
||||
gridObjects.Add(gridArray[x, y + 1]);
|
||||
}
|
||||
|
||||
return gridObjects;
|
||||
}
|
||||
|
||||
public Vector3 GetWorldPosition(int x, int y)
|
||||
{
|
||||
return new Vector3(x, y) * cellSize + originPosition;
|
||||
|
||||
@@ -11,8 +11,9 @@ public abstract class PlacedObject : MonoBehaviour
|
||||
placedObject.placedObjectTypeSO = placedObjectTypeSO;
|
||||
placedObject.origin = origin;
|
||||
|
||||
placedObject.OnPlace();
|
||||
|
||||
placedObject.SetIsBlueprint(false);
|
||||
placedObject.OnPlace();
|
||||
|
||||
if (placedObjectTypeSO.isWalkable)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user