public static void InitializeAccessory(GameObject selectedObject) { GameObject hairObject = selectedObject; hairObject.layer = 10; if (hairObject != null) { AIChara.CmpAccessory accComponent = hairObject.GetComponent <AIChara.CmpAccessory>(); if (accComponent == null) { accComponent = hairObject.AddComponent <AIChara.CmpAccessory>(); } FindAssist findAssist = new FindAssist(); findAssist.Initialize(accComponent.transform); accComponent.trfMove01 = findAssist.GetTransformFromName("N_move"); accComponent.trfMove02 = findAssist.GetTransformFromName("N_move2"); Renderer[] renderers = hairObject.GetComponentsInChildren <Renderer>(); accComponent.rendCheckVisible = new Renderer[renderers.Length]; accComponent.rendNormal = new Renderer[renderers.Length]; for (int i = 0; i < renderers.Length; i++) { renderers[i].gameObject.layer = 10; accComponent.useColor01 = true; accComponent.rendCheckVisible[i] = renderers[i]; accComponent.rendNormal[i] = renderers[i]; } } }
public CmpAccessory GetExtraAccessoryComponent(int parts) { if (this.cmpExtraAccessory == null) { return((CmpAccessory)null); } if (parts >= this.cmpExtraAccessory.Length) { return((CmpAccessory)null); } CmpAccessory cmpAccessory = this.cmpExtraAccessory[parts]; return(Object.op_Equality((Object)null, (Object)cmpAccessory) ? (CmpAccessory)null : cmpAccessory); }