void SpawnGhost(Vector3 pos) { GameObject newGhost = (GameObject)Instantiate(Resources.Load("Editor/Block", typeof(GameObject)), pos, FaceAxis.GetRotator(pos)); newGhost.AddComponent <LevelEditorObject>().PrefabName = "Editor/Block"; foreach (Collider2D coll in newGhost.GetComponents <Collider2D>()) { coll.enabled = false; } ghosts.Add(newGhost); }
void PlaceRing() { Vector3 pos = GetPos(); float deltaAngle = 360 / angularGridDensity; Quaternion rotator = Quaternion.Euler(0, 0, deltaAngle); for (int i = 0; i < angularGridDensity; i++) { pos = rotator * pos; GameObject newObject = (GameObject)Instantiate(Resources.Load("Editor/Block", typeof(GameObject)), pos, FaceAxis.GetRotator(pos)); LevelEditorObject leo = newObject.AddComponent <LevelEditorObject>(); leo.PrefabName = "Editor/Block"; leo.IsPlaced = true; newObject.transform.parent = root.transform; //newObject.layer = layer; //objects.Add(newObject); } }
void SpawnRing() { Vector3 pos = GetPos(); float deltaAngle = 360 / angularGridDensity; Quaternion rotator = Quaternion.Euler(0, 0, deltaAngle); for (int i = 0; i < angularGridDensity; i++) { pos = rotator * pos; GameObject newGhost = (GameObject)Instantiate(Resources.Load("Editor/Block", typeof(GameObject)), pos, FaceAxis.GetRotator(pos)); LevelEditorObject leo = newGhost.AddComponent <LevelEditorObject>(); leo.PrefabName = "Editor/Block"; leo.IsPlaced = false; foreach (Collider2D coll in newGhost.GetComponents <Collider2D>()) { coll.enabled = false; } ghosts.Add(newGhost); //newObject.transform.parent = root.transform; //newObject.layer = layer; //objects.Add(newObject); } }