public override void OnBeforeRemovedFromContainer()
 {
     PhysicsNode.RemoveFromContainer();
     _eventBus        = null;
     _modelAttachment = null;
     base.OnBeforeRemovedFromContainer();
 }
 public override void OnAddedToContainer()
 {
     base.OnAddedToContainer();
     _eventBus        = Container.Get <MyComponentEventBus>();
     _modelAttachment = Container.Get <MyModelAttachmentComponent>();
     PhysicsNode.AddToContainer();
 }
Ejemplo n.º 3
0
 public override void OnBeforeRemovedFromContainer()
 {
     base.OnBeforeRemovedFromContainer();
     _state.StateChanged -= OnStateChanged;
     _eventBus            = null;
     _state = null;
 }
Ejemplo n.º 4
0
 public override void OnAddedToContainer()
 {
     base.OnAddedToContainer();
     _eventBus            = Container.Get <MyComponentEventBus>();
     _state               = Container.Get <MyEntityStateComponent>();
     _state.StateChanged += OnStateChanged;
 }
Ejemplo n.º 5
0
 public override void OnRemovedFromScene()
 {
     base.OnRemovedFromScene();
     if (!MyMultiplayerModApi.Static.IsServer)
     {
         return;
     }
     foreach (var evt in Definition.Events)
     {
         _eventBus.RemoveListener(evt, EventOccured);
     }
     _eventBus = null;
     _state    = null;
     RemoveScheduledUpdate(Update);
 }
Ejemplo n.º 6
0
 public override void OnAddedToScene()
 {
     base.OnAddedToScene();
     if (!MyMultiplayerModApi.Static.IsServer)
     {
         return;
     }
     _eventBus = Container.Get <MyComponentEventBus>();
     _state    = Container.Get <MyEntityStateComponent>();
     foreach (var evt in Definition.Events)
     {
         _eventBus.AddListener(evt, EventOccured);
     }
     if (_requestedState.HasValue)
     {
         Update(0);
     }
 }