void Awake() { rd = GetComponentInChildren <ResourceDrop>(); cm = GetComponentInChildren <UEO_ColorCycler>(); oc = GetComponentInChildren <UEO_ObjectCycler>(); cs = GetComponentInChildren <UEO_ScaleManipulator>(); }
void UpdateLabel() { if (LevelBuilder.inst.currentPiece) { UEO_ObjectCycler cy = LevelBuilder.inst.currentPiece.GetComponent <UEO_ObjectCycler>(); if (cy) { label.text = cy.objectsToCycle[cy.objectIndex].name; } } }
public virtual void SetProperties(SimpleJSON.JSONClass N) { // return; // Debug.Log("set prop:"+N.ToString()); if (N.GetKeys().Contains(uuidKey)) { SetUuid("setprop", N[uuidKey].AsInt); // Debug.Log("just set my uuid key:"+N[uuidKey].AsInt); } ResourceDrop rd = GetComponentInChildren <ResourceDrop>(); if (rd && N.GetKeys().Contains(ResourceDrop.key)) { // Debug.Log("set prop resource:"+N.ToString()); rd.SetProperties(N); } if (N.GetKeys().Contains(JsonUtil.scaleKey)) { // Debug.Log("set scale on: "+myName+", "+N[JsonUtil.scaleKey].AsInt); // name += " scaled."; transform.localScale = JsonUtil.GetScaleFromInt(N[JsonUtil.scaleKey].AsInt); scaleSetFromInstanceLoad = true; } UEO_ScaleManipulator cs = GetComponentInChildren <UEO_ScaleManipulator>(); if (cs && N.GetKeys().Contains(UEO_ScaleManipulator.key)) { int x = MathUtils.IntParse(N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyX].Value); int y = MathUtils.IntParse(N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyY].Value); int z = MathUtils.IntParse(N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyZ].Value); cs.transform.localScale = new Vector3(x, y, z); cs.UpdateSize(x, y, z); // if (cloneObject) cloneObject.transform.localScale = transform.localScale; } if (N.GetKeys().Contains(UEO_ColorCycler.colorManipulatorKey)) { UEO_ColorCycler cc = GetComponentInChildren <UEO_ColorCycler>(); if (cc) { cc.SetProperties(N); } } if (N.GetKeys().Contains(UEO_ObjectCycler.objectIndexKey)) { UEO_ObjectCycler cc = GetComponentInChildren <UEO_ObjectCycler>(); if (cc) { cc.SetProperties(N); } } if (N.GetKeys().Contains(tagsKey)) { if (N[tagsKey].Value.Length > 0) { myTags.AddRange(N[tagsKey].Value.Split(',')); // Debug.Log("<color=#f0f>addtag:</color>"+N[tagsKey].Value); } // Debug.Log("tags!:"+tags+", json val:"+N[tagsKey].ToString()); } else { // print("no tagskey on:"+myName); } PickUppableObject pip = GetComponent <PickUppableObject>(); if (pip) { // Vadim todo add Interface IMySetProperties? pip.SetProperties(N); } }