private void OnEnable() { var fusion = Fusion.Mount(gameObject); fusion.Add(Recipe); DestroyImmediate(this); }
public static Fusion Create(string name, Action <Fusion> addComponents = null) { var fuser = new Fusion(name); if (addComponents != null) { fuser.Add(addComponents); } return(fuser); }
public Fusion NewChild(string tag, Action <Fusion> addParts = null) { var child = new Fusion(tag); child.Transform.SetParent(Transform); if (addParts != null) { child.Add(addParts); } return(child); }
private void CreatePrototypes() { foreach (var kvp in Recipes) { var recipe = kvp.Value; var type = kvp.Key; var go = Fusion.Create(type.Name, recipe).Go; go.transform.SetParent(_prototypesParent); go.SetActive(false); _prototypes[type] = go; _pools[type] = new Stack <GameObject>(); } }