|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Security.Policy;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class FloorSetter : MonoBehaviour
|
|
|
|
{
|
|
|
|
public List<Transform> transforms;
|
|
|
|
public GameObject prefab;
|
|
|
|
public GameObject CubePrefab;
|
|
|
|
|
|
|
|
public List<Vector3> positions;
|
|
|
|
|
|
|
|
//public void OnValidate()
|
|
|
|
//{
|
|
|
|
// Instantiator();
|
|
|
|
//}
|
|
|
|
[ContextMenu("PositionTaker")]
|
|
|
|
public void PositionTaker()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < transforms.Count; i++)
|
|
|
|
{
|
|
|
|
positions.Add(transforms[i].localPosition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[ContextMenu("Instantiator")]
|
|
|
|
public void Instantiator()
|
|
|
|
{
|
|
|
|
// for (int i = 0; i < positions.Count; i++)
|
|
|
|
// {
|
|
|
|
// Transform temp=Instantiate(CubePrefab,this.transform).transform;
|
|
|
|
|
|
|
|
// //Transform temp = Instantiate(new GameObject(), this.transform).transform;
|
|
|
|
// temp.localPosition = positions[i];
|
|
|
|
// //Instantiate(prefab, temp);
|
|
|
|
// }
|
|
|
|
for (int i = 0; i < positions.Count; i++)
|
|
|
|
{
|
|
|
|
//Transform temp=Instantiate(CubePrefab,this.transform).transform;
|
|
|
|
|
|
|
|
Transform temp = Instantiate(new GameObject(), this.transform).transform;
|
|
|
|
temp.name = "Floor Position";
|
|
|
|
temp.localPosition = positions[i];
|
|
|
|
Instantiate(prefab, temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|