private static void CopyCat( EffectCategory copy, EffectCategory old, Dictionary<String, EffectCategory> catIndex ) { var copyObj = copy.obj.transform; var copyRoot = catIndex[rootName].obj.transform; foreach( var child in old.childLoop ) { var copyChild = copyObj.Find( child.name ); if( copyChild == null ) { Main.LogE( "Couldn't find child named: " + child.name ); continue; } copy.AddChild( child.Duplicate( copyChild.gameObject, copy ) ); } foreach( var childCat in old.childCatsLoop ) { var path = childCat.path; var copyTemp = copyRoot.Find( path ); if( copyTemp == null ) { Main.LogE( "Unable to find child at path: " + path ); continue; } var copyCat = new EffectCategory( childCat.name, copyTemp.gameObject, copy ); catIndex[copyCat.name] = copyCat; CopyCat( copyCat, childCat, catIndex ); } }
public EffectCategory(String name, GameObject obj, EffectCategory parent) { this.name = name; this.obj = obj; this.parent = parent; this.parent.childCats[name] = this; }
internal EffectElement(String name, EffectCategory parent) { this.obj = new GameObject(); this.name = name; this.parent = parent; parent.AddChild(this); this.obj.transform.parent = parent.obj.transform.parent; this.scale = Vector3.one; this.position = Vector3.zero; this.rotation = Quaternion.identity; }
private void TransferCategories( GameObject clone ) { var control = clone.AddComponent<BuiltEffectController>(); var newCats = control.categories; var newMain = clone.transform; var cats = this.categories; var main = cats[rootName].obj.transform; var mainCat = cats[rootName]; var newMainCat = new EffectCategory( clone ); newCats[rootName] = newMainCat; CopyCat( newMainCat, mainCat, newCats ); }
private ParticleElement(ParticleElement orig, GameObject newObj, EffectCategory newParent) : base(orig, newObj, newParent) { this.partSys = newObj.GetComponent <ParticleSystem>(); this.partRend = newObj.GetComponent <ParticleSystemRenderer>(); }
internal ParticleElement(String name, EffectCategory parent) : base(name, parent) { this.partSys = base.obj.AddComponent <ParticleSystem>(); this.partRend = base.obj.AddOrGetComponent <ParticleSystemRenderer>(); }
internal override EffectElement Duplicate(GameObject newObj, EffectCategory newParent) { return(new ParticleElement(this, newObj, newParent)); }
public EffectCategory(GameObject obj) { this.name = EffectBuilder.rootName; this.obj = obj; this.parent = null; }
internal EffectElement(EffectElement orig, GameObject newObj, EffectCategory newParent) { this.obj = newObj; this.name = orig.name; this.parent = newParent; }
internal abstract EffectElement Duplicate(GameObject newObj, EffectCategory newParent);