예제 #1
0
 public void DetachFromEntity()
 {
     if (this.handleAutomaticaly)
     {
         throw new Exception("Couldn't detach entity from entityBehaviour in automatically mode");
     }
     if (this.Entity != null)
     {
         if (((EntityInternal)this.Entity).Alive && ClientUnityIntegrationUtils.HasWorkingEngine())
         {
             this.RemoveUnityComponentsFromEntity();
         }
         this.Entity = null;
     }
 }
예제 #2
0
 public void CreateEntity()
 {
     if (ClientUnityIntegrationUtils.HasWorkingEngine())
     {
         this.DoCreateEntity(EngineService.Engine);
     }
     else
     {
         DelayedEntityBehaviourActivator activator = FindObjectOfType <DelayedEntityBehaviourActivator>();
         if (activator)
         {
             activator.DelayedEntityBehaviours.Add(this);
         }
         else
         {
             object[] args = new object[] { base.name, typeof(DelayedEntityBehaviourActivator).Name };
             Debug.LogWarningFormat("EntityBehaviour {0} can't be delayed, 'cause {1} is not exists", args);
         }
     }
 }
예제 #3
0
 private void OnDisable()
 {
     if (this.handleAutomaticaly && ((this.Entity != null) && (((EntityInternal)this.Entity).Alive && ClientUnityIntegrationUtils.HasWorkingEngine())))
     {
         this.DestroyEntity();
     }
 }
예제 #4
0
 private void OnDestroy()
 {
     if (!this.handleAutomaticaly && ((this.Entity != null) && (((EntityInternal)this.Entity).Alive && ClientUnityIntegrationUtils.HasWorkingEngine())))
     {
         this.RemoveUnityComponentsFromEntity();
     }
 }