Beispiel #1
0
        internal void ApplyPatch(ColliderPatch patch)
        {
            _collider.enabled   = _collider.enabled.GetPatchApplied(IsEnabled.ApplyPatch(patch.IsEnabled));
            _collider.isTrigger = _collider.isTrigger.GetPatchApplied(IsTrigger.ApplyPatch(patch.IsTrigger));

            if (patch.EventSubscriptions != null)
            {
                // Clear existing subscription flags and set them to the new values.  We do not patch arrays,
                // and thus we will always send the entire value down for all of the subscriptions.
                _colliderEventSubscriptions = ColliderEventType.None;
                foreach (var sub in patch.EventSubscriptions)
                {
                    _colliderEventSubscriptions |= sub;
                }
            }
        }
        internal void ApplyPatch(ColliderPatch patch)
        {
            _collider.enabled                  = _collider.enabled.GetPatchApplied(IsEnabled.ApplyPatch(patch.Enabled));
            _collider.isTrigger                = _collider.isTrigger.GetPatchApplied(IsTrigger.ApplyPatch(patch.IsTrigger));
            _collider.material.bounciness      = _collider.material.bounciness.GetPatchApplied(Bounciness.ApplyPatch(patch.Bounciness));
            _collider.material.staticFriction  = _collider.material.staticFriction.GetPatchApplied(StaticFriction.ApplyPatch(patch.StaticFriction));
            _collider.material.dynamicFriction = _collider.material.dynamicFriction.GetPatchApplied(DynamicFriction.ApplyPatch(patch.DynamicFriction));

            MREAPI.AppsAPI.LayerApplicator.ApplyLayerToCollider(patch.Layer, _collider);

            if (patch.EventSubscriptions != null)
            {
                // Clear existing subscription flags and set them to the new values.  We do not patch arrays,
                // and thus we will always send the entire value down for all of the subscriptions.
                _colliderEventSubscriptions = ColliderEventType.None;
                foreach (var sub in patch.EventSubscriptions)
                {
                    _colliderEventSubscriptions |= sub;
                }
            }
        }
 internal void ApplyPatch(ColliderPatch patch)
 {
     _collider.enabled   = _collider.enabled.GetPatchApplied(IsEnabled.ApplyPatch(patch.IsEnabled));
     _collider.isTrigger = _collider.isTrigger.GetPatchApplied(IsTrigger.ApplyPatch(patch.IsTrigger));
 }