Exemplo n.º 1
0
        private void OnParentChanged(MyHierarchyComponent target, MyHierarchyComponent oldParent, MyHierarchyComponent newParent)
        {
            var parent = _hierarchy?.Parent?.Entity?.Components.Get <MyEntityOwnershipComponent>();

            if (_parent == parent)
            {
                return;
            }
            if (_parent != null)
            {
                _parent.OwnerChanged -= ParentOwnerChanged;
            }
            if (parent != null)
            {
                parent.OwnerChanged += ParentOwnerChanged;
            }
            _parent = parent;
            ParentOwnerChanged(parent, 0, 0);
        }
Exemplo n.º 2
0
 private void ParentOwnerChanged(MyEntityOwnershipComponent c, long arg1, long arg2)
 {
     OwnerId   = _parent?.OwnerId ?? 0;
     ShareMode = _parent?.ShareMode ?? MyOwnershipShareModeEnum.None;
 }