Exemple #1
0
                public static MoveDouble Create(Property p, Vector3 o, Axis3 a, Vector3Callback 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);
                    }
                    MoveDouble m = g.AddComponent <MoveDouble>();

                    m.property   = p;
                    m.DragEvent += c;
                    return(m);
                }
Exemple #2
0
                public static Scale Create(Property p, Vector3 o, Vector3Callback c)
                {
                    Scale s = null;

                    if (p.sdp.Count > 0)
                    {
                        s = p.sdp.Dequeue();
                        s.gameObject.SetActive(true);
                        s.origin = o;
                        for (int i = 0; i < 3; i++)
                        {
                            s.s[i].origin = o[i];
                        }
                        s.a.origin = 1.0f;
                    }
                    else
                    {
                        s        = new GameObject("Scale Handle").AddComponent <Scale>();
                        s.origin = o;
                        s.transform.SetParent(Parent);
                        ScaleSingle x = ScaleSingle.Create(p, s.origin.x, Axis3.X, (v) => { s.origin.x = v; s.callback(s.origin); });
                        x.transform.SetParent(s.transform, false);
                        s.s[0] = x;
                        ScaleSingle y = ScaleSingle.Create(p, s.origin.y, Axis3.Y, (v) => { s.origin.y = v; s.callback(s.origin); });
                        y.transform.SetParent(s.transform, false);
                        s.s[1] = y;
                        ScaleSingle z = ScaleSingle.Create(p, s.origin.z, Axis3.Z, (v) => { s.origin.z = v; s.callback(s.origin); });
                        z.transform.SetParent(s.transform, false);
                        s.s[2] = z;
                        ScaleAll a = ScaleAll.Create(p, 1.0f, (v) => { s.callback(s.origin * v); });
                        a.UpEvent += (v) => { s.origin *= v; x.origin = s.origin.x; y.origin = s.origin.y; z.origin = s.origin.z; };
                        a.transform.SetParent(s.transform, false);
                        s.a = a;
                    }
                    s.callback = c;
                    s.property = p;
                    p.sep.Add(s);
                    return(s);
                }
Exemple #3
0
                public static Move Create(Property p, Vector3 o, Vector3Callback c)
                {
                    Move m = null;

                    if (p.mdp.Count > 0)
                    {
                        m = p.mdp.Dequeue();
                        m.gameObject.SetActive(true);
                        m.transform.position = o;
                    }
                    else
                    {
                        m = new GameObject("Position Handle").AddComponent <Move>();
                        m.transform.position = o;
                        m.transform.SetParent(Parent);
                        Vector3Callback _c = (v) => { m.transform.position = v; if (m.callback != null)
                                                      {
                                                          m.callback(v);
                                                      }
                        };

                        for (int i = 0; i < 3; i++)
                        {
                            MoveSingle s = MoveSingle.Create(p, o, (Axis3)i, null);
                            s.transform.SetParent(m.transform, false);
                            s.DragEvent += (v) => { _c(v); s.transform.position = v; };
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            MoveDouble d = MoveDouble.Create(p, o, (Axis3)i, null);
                            d.transform.SetParent(m.transform, false);
                            d.DragEvent += (v) => { _c(v); d.transform.position = v; };
                        }
                    }
                    m.callback = c;
                    m.property = p;
                    p.mep.Add(m);
                    return(m);
                }
Exemple #4
0
 public Handle CreateScale(Vector3 scal, Vector3Callback callback)
 {
     return(Scale.Create(this, scal, callback));
 }
Exemple #5
0
 public Handle CreatePosition(Vector3 pos, Vector3Callback callback)
 {
     return(Move.Create(this, pos, callback));
 }
Exemple #6
0
 public static extern Vector3 PassThroughVector3ToCallback(Vector3 startingVector, Vector3Callback callback);