public override void Init(JediumBehaviourSnapshot snapshot)
        {
            base.Init(snapshot);

            if (snapshot.BehaviourType != "Transform")
            {
                return;
            }
            JediumTransformSnapshot t = (JediumTransformSnapshot)snapshot;

            _lastMessage = new JediumTransformMessage(t.X, t.Y, t.Z, t.RotX, t.RotY, t.RotZ, t.RotW, t.ScaleX, t.ScaleY, t.ScaleZ);

            transform.position   = new Vector3(t.X, t.Y, t.Z);
            transform.rotation   = new Quaternion(t.RotX, t.RotY, t.RotZ, t.RotW);
            transform.localScale = new Vector3(t.ScaleX, t.ScaleY, t.ScaleZ);
        }
Esempio n. 2
0
        public override void FromSnapshot(JediumBehaviourSnapshot snap)
        {
            if (snap.GetBehaviourType() != "Transform")
            {
                _log.Warn($"Wrong snapshot type: {snap.GetBehaviourType()}");
                return;
            }

            JediumTransformSnapshot tsnap = (JediumTransformSnapshot)snap;

            _posX   = tsnap.X;
            _posY   = tsnap.Y;
            _posZ   = tsnap.Z;
            _quatX  = tsnap.RotX;
            _quatY  = tsnap.RotY;
            _quatZ  = tsnap.RotZ;
            _quatW  = tsnap.RotW;
            _scaleX = tsnap.ScaleX;
            _scaleY = tsnap.ScaleY;
            _scaleZ = tsnap.ScaleZ;
        }
Esempio n. 3
0
 public JediumTransform(JediumGameObject parent, JediumTransformSnapshot snap) : base(parent)
 {
     _log = LogManager.GetLogger("Transform: " + parent.LocalId);
     FromSnapshot(snap);
 }
Esempio n. 4
0
 /// <summary>
 /// Unboxing all state (position, rotation, scale) from Game Object Box
 /// </summary>
 /// <param name="t"></param>
 /// <param name="box"></param>
 public static void SetTransformFromGameObjectBox(this Transform t, JediumTransformSnapshot box)
 {
     t.position   = new Vector3(box.X, box.Y, box.Z);
     t.rotation   = new Quaternion(box.RotX, box.RotY, box.RotZ, box.RotW);
     t.localScale = new Vector3(box.ScaleX, box.ScaleY, box.ScaleZ);
 }