Example #1
0
            private void removeReferences()
            {
                DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();

                dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <ServerObjectPositionData> >(onComponentAdded);
                dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved);
                serverObjectItemData = null;
                propService          = null;
                handle = null;
            }
Example #2
0
            public ServerObjectTracker(PropService propService, DataEntityHandle handle, ServerObjectItemData serverObjectItemData)
            {
                this.serverObjectItemData = serverObjectItemData;
                this.propService          = propService;
                this.handle = handle;
                DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();

                if (dataEntityCollection.TryGetComponent <ServerObjectPositionData>(handle, out var component))
                {
                    spawnObject(component.Position);
                    return;
                }
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ServerObjectPositionData> >(onComponentAdded);
                dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.EntityRemovedEvent>(onItemRemoved);
            }