예제 #1
0
        public override void OnAwakeInitialize(bool isNetObject)
        {
            /// If not a NetObject, we need to register our timing callbacks directly with the NetMaster
            /// since there is no NetObject to generate these.
            if (!isNetObject)
            {
                NetMasterCallbacks.onPreSimulates.Add(this);
                NetMasterCallbacks.onPreUpdates.Add(this);
            }

            rb   = GetComponent <Rigidbody>();
            rb2d = GetComponent <Rigidbody2D>();

            /// Force RBs to be kinematic
            if ((rb && !rb.isKinematic) || (rb2d && !rb2d.isKinematic))
            {
                Debug.LogWarning(GetType().Name + " doesn't work with non-kinematic rigidbodies. Setting to kinematic.");
                if (rb)
                {
                    rb.isKinematic = true;
                }
                else
                {
                    rb2d.isKinematic = true;
                }
            }

            syncTransform = GetComponent <SyncTransform>();

            Recalculate();
        }
예제 #2
0
            public Frame(SyncTransform sst, int frameId) : base(frameId)
            {
                m      = new Matrix();
                cm     = new CompressedMatrix();
                telem  = new Matrix();
                telecm = new CompressedMatrix();
                sst.transformCrusher.Capture(sst.transform, cm, m);
                var par = sst.transform.parent;

                parentHash = par ? par.GetInstanceID() : -1;
            }
예제 #3
0
        public override void OnAwake()
        {
            base.OnAwake();

            iSpawnController = GetComponent <ISpawnController>();

            syncTransform = GetComponent <SyncTransform>();
            syncOwner     = GetComponent <SyncOwner>();

            transform.GetNestedComponentsInChildren <IOnStateChange, NetObject>(onStateChangeCallbacks);
            transform.GetComponents(flagTeleportCallbacks);

            mountsLookup = netObj.GetComponent <MountsManager>();
        }
예제 #4
0
 public void Set(SyncTransform sst, int frameId)
 {
     sst.transformCrusher.Capture(sst.transform, cm, m);
 }