コード例 #1
0
 protected virtual void OnDisable()
 {
     if (preventRepeats)
     {
         NetMasterCallbacks.RegisterCallbackInterfaces(this, false, true);
     }
 }
コード例 #2
0
        private void Awake()
        {
            rb                  = GetComponentInParent <Rigidbody>();
            rb2d                = GetComponentInParent <Rigidbody2D>();
            _hasRigidBody       = rb || rb2d;
            useRbForces         = rb && !rb.isKinematic;
            useRb2dForces       = rb2d && !rb2d.isKinematic;
            useRBGravity        = (rb && rb.useGravity) || (rb2d && rb.useGravity);
            needsSnapshot       = !_hasRigidBody || (rb && rb.isKinematic) || (rb2d && rb2d.isKinematic);
            localContactTrigger = GetComponent <IContactTrigger>();
            /// Register timing callbacks with Master.
            /// TODO: We likely should slave timings off of the owner
            if (needsSnapshot)
            {
                NetMasterCallbacks.RegisterCallbackInterfaces(this);
            }

            /// No need for the interpolation callback if we are using forces.
            if (_hasRigidBody)
            {
                NetMasterCallbacks.onPreUpdates.Remove(this);
            }

            /// Find interfaces for termination callbacks
            GetComponents(onHit);
            GetComponents(onTerminate);
        }
コード例 #3
0
        protected virtual void OnEnable()
        {
            if (preventRepeats)
            {
                NetMasterCallbacks.RegisterCallbackInterfaces(this);

                triggeringHitscans.Clear();
                triggeringEnters.Clear();
                triggeringStays.Clear();
            }
        }
コード例 #4
0
 private void OnDestroy()
 {
     NetMasterCallbacks.RegisterCallbackInterfaces(this, false, true);
 }