Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 3
0
 private void OnDisable()
 {
     if (this.handleAutomaticaly && ((this.Entity != null) && (((EntityInternal)this.Entity).Alive && ClientUnityIntegrationUtils.HasWorkingEngine())))
     {
         this.DestroyEntity();
     }
 }
Exemplo n.º 4
0
 private void OnDestroy()
 {
     if (!this.handleAutomaticaly && ((this.Entity != null) && (((EntityInternal)this.Entity).Alive && ClientUnityIntegrationUtils.HasWorkingEngine())))
     {
         this.RemoveUnityComponentsFromEntity();
     }
 }