public static T Populate <T>(this object o, int poolID, int prefabID, string parentID, Vector3 startPosition = default(Vector3), Quaternion startRotation = default(Quaternion)) where T : class { var parent = Toolbox.Get <ProcessingScene>().Get(parentID); var tr = o.Populate(poolID, prefabID, startPosition, startRotation, parent); return(tr.GetComponent <T>()); }
public void GetFromToolbox(object behavior) { for (int i = 0; i < cachedToolboxFields.Count; i++) { var myFieldInfo = cachedToolboxFields[i]; var fieldType = myFieldInfo.FieldType; myFieldInfo.SetValue(behavior, Toolbox.Get(fieldType)); } }
public static void Setup(object b) { var type = b.GetType(); CachedType o; bool isCached = cached.TryGetValue(type, out o); if (!isCached) { o = new CachedType(); var objectFields = type.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); int length = objectFields.Length; cached.Add(type, o); for (int i = 0; i < length; i++) { var myFieldInfo = objectFields[i]; var attribute = Attribute.GetCustomAttribute(objectFields[i], typeof(BindAttribute)) as BindAttribute; if (attribute == null) { continue; } var fieldType = myFieldInfo.FieldType; switch (attribute.bindType) { case 0: break; case 1: myFieldInfo.SetValue(b, Toolbox.Get(fieldType)); o.cachedToolboxFields.Add(myFieldInfo); break; case 2: break; case 3: break; } } } else { o.GetFromToolbox(b); } }
public string Help() { return(Toolbox.Get <ProcessorConsole>().Help()); }