7 public const string COMPONENT_SUFFIX =
"Component";
9 public static string AddComponentSuffix(
this string componentName) {
10 return componentName.EndsWith(COMPONENT_SUFFIX,
System.StringComparison.Ordinal)
12 : componentName + COMPONENT_SUFFIX;
15 public static string RemoveComponentSuffix(
this string componentName) {
16 return componentName.EndsWith(COMPONENT_SUFFIX,
System.StringComparison.Ordinal)
17 ? componentName.Substring(0, componentName.Length - COMPONENT_SUFFIX.Length)
25 bool replaceExisting =
false,
26 params
int[] indices) {
27 var componentIndices = indices.Length == 0
30 for(
int i = 0; i < componentIndices.Length; i++) {
31 var index = componentIndices[i];
34 index, component.GetType()
36 component.CopyPublicMemberValues(clonedComponent);
Entity ReplaceComponent(int index, IComponent component)
static void CopyTo(this Entity entity, Entity target, bool replaceExisting=false, params int[] indices)
IComponent CreateComponent(int index, Type type)
IComponent GetComponent(int index)
int [] GetComponentIndices()
Returns all indices of added components.
Entity AddComponent(int index, IComponent component)