Net_Ease_Dome/Assets/Scripts/Grids/GridElements.cs

37 lines
924 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GridElements : MonoBehaviour
{
public byte x_Pos;
public byte z_Pos;
public bool AutoHandle = false;
public Transform InitPos; //Éú³Éµã
public List<GridElements> NearGrids = new List<GridElements>(); //ÏàÁÚ¸ñ×Ó
public Rect MyRect = new Rect();
private void Awake()
{
InitPos = transform.GetChild(0);
}
[ContextMenu("SetRect")]
private void SetMyRect()
{
Vector3 pos = transform.position;
float width = transform.localScale.x;
float length = transform.localScale.z;
MyRect = new Rect(pos.x - width / 2, pos.z - length / 2, width, length);
}
private void Reset()
{
return;
string myname = transform.name;
x_Pos = byte.Parse(myname[0].ToString());
z_Pos = byte.Parse(myname[1].ToString());
}
}