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