/// <summary> /// 附加子实体。 /// </summary> /// <param name="childEntity">要附加的子实体。</param> /// <param name="parentEntity">被附加的父实体。</param> /// <param name="parentTransformPath">相对于被附加父实体的位置。</param> /// <param name="userData">用户自定义数据。</param> public void AttachEntity(Entity childEntity, Entity parentEntity, string parentTransformPath, object userData) { if (childEntity == null) { Log.Warning("Child entity is invalid."); return; } if (parentEntity == null) { Log.Warning("Parent entity is invalid."); return; } Transform parentTransform = null; if (string.IsNullOrEmpty(parentTransformPath)) { parentTransform = parentEntity.Logic.CachedTransform; } else { parentTransform = parentEntity.Logic.CachedTransform.Find(parentTransformPath); if (parentTransform == null) { Log.Warning("Can not find transform path '{0}' from parent entity '{1}'.", parentTransformPath, parentEntity.Logic.Name); parentTransform = parentEntity.Logic.CachedTransform; } } m_EntityManager.AttachEntity(childEntity, parentEntity, new AttachEntityInfo(parentTransform, userData)); }
public void AttachEntity(Entity childEnity, Entity parentEntity, Transform parentTransform, object userData) { if (parentTransform) { parentTransform = parentEntity.Logic.CachedTransform; } m_EntityManager.AttachEntity(childEnity, parentEntity, new AttachEntityInfo(parentTransform, userData)); }
/// <summary> /// 附加子实体。 /// </summary> /// <param name="childEntity">要附加的子实体。</param> /// <param name="parentEntity">被附加的父实体。</param> /// <param name="parentTransform">相对于被附加父实体的位置。</param> /// <param name="userData">用户自定义数据。</param> public void AttachEntity(Entity childEntity, Entity parentEntity, Transform parentTransform, object userData) { if (childEntity == null) { Log.Warning("Child entity is invalid."); return; } if (parentEntity == null) { Log.Warning("Parent entity is invalid."); return; } if (parentTransform == null) { parentTransform = parentEntity.Logic.CachedTransform; } m_EntityManager.AttachEntity(childEntity, parentEntity, new AttachEntityInfo(parentTransform, userData)); }
/// <summary> /// 附加子实体。 /// </summary> /// <param name="childEntity">要附加的子实体。</param> /// <param name="parentEntity">被附加的父实体。</param> /// <param name="parentTransform">相对于被附加父实体的位置。</param> /// <param name="userData">用户自定义数据。</param> public void AttachEntity(Entity childEntity, Entity parentEntity, Transform parentTransform, object userData) { if (childEntity == null) { Log.Warning("Child entity is invalid."); return; } if (parentEntity == null) { Log.Warning("Parent entity is invalid."); return; } if (parentTransform == null) { parentTransform = parentEntity.Logic.CachedTransform; } AttachEntityInfo attachEntityInfo = ReferencePool.Acquire <AttachEntityInfo>(); attachEntityInfo.Initialize(parentTransform, userData); m_EntityManager.AttachEntity(childEntity, parentEntity, attachEntityInfo); }