public static RotaSingle Create(Property p, Quaternion o, Axis3 a, QuaternionCallback c) { GameObject g = null; switch (a) { case Axis3.X: g = GameObject.Instantiate(x.Object); break; case Axis3.Y: g = GameObject.Instantiate(y.Object); break; case Axis3.Z: g = GameObject.Instantiate(z.Object); break; default: return(null); } RotaSingle r = g.AddComponent <RotaSingle>(); r.property = p; r.DragEvent += c; return(r); }
public static Rota Create(Property p, Quaternion o, QuaternionCallback c) { Rota r = null; if (p.rdp.Count > 0) { r = p.rdp.Dequeue(); r.gameObject.SetActive(true); r.transform.rotation = o; } else { r = new GameObject("Rotation Handle").AddComponent <Rota>(); r.transform.rotation = o; r.transform.SetParent(Parent); QuaternionCallback _c = (v) => { r.transform.rotation = v; if (r.callback != null) { r.callback(v); } }; for (int i = 0; i < 3; i++) { RotaSingle s = RotaSingle.Create(p, o, (Axis3)i, null); s.transform.SetParent(r.transform, false); s.DragEvent += _c; } } r.callback = c; r.property = p; p.rep.Add(r); return(r); }