You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BuildSystem
{
public class Grid
{
public int x { get; }
public int y { get; }
public int z { get; }
public Vector3Int logicPos;
public Grid up;
public Grid down;
public Grid left;
public Grid right;
public IsHave[] isHaves = new IsHave[4] { IsHave.None, IsHave.None , IsHave.None , IsHave.None };
public Vector3 pos { get; }
public bool isPlace = false;
public PlaceObjectType type = PlaceObjectType.None;
public Grid(Vector3Int logicPos) {
this.logicPos = logicPos;
x = this.logicPos.x;
y = this.logicPos.y;
z = this.logicPos.z;
float gridSize = BuildSystemManager.Instance.gridSize;
pos = BuildSystemManager.Instance.startPos + new Vector3(
gridSize / 2 + x * gridSize,
0,
gridSize / 2 + z * gridSize);
up = null;
down = null;
left = null;
right = null;
type = PlaceObjectType.None;
}
public Grid(int x,int y ,int z)
{
this.x = x;
this.y = y;
this.z = z;
logicPos = new Vector3Int(x,y,z); ;
float gridSize = BuildSystemManager.Instance.gridSize;
pos = BuildSystemManager.Instance.startPos + new Vector3(
gridSize / 2 + x * gridSize,
0,
gridSize / 2 + z * gridSize);
up = null;
down = null;
left = null;
right = null;
type = PlaceObjectType.None;
}
}
}