//private SkinnedMeshRenderer targetRenderer; //private List<Material> targetMaterials; public void Init(VisualCustomisation customisation) { VisualCustomisation = customisation; TitleText.text = VisualCustomisation.Identifier; cached_targets = new List <GameObject>(); if (VisualCustomisation.CustomisationType == VisualCustomisationType.GameObject) { //Cache values VisualCustomisation.TargetedGameObjectNames.ForEach(t => cached_targets.Add(FindTargetObject(t))); _maxOption = VisualCustomisation.TargetedGameObjectNames.Count - 1; } else if (VisualCustomisation.CustomisationType == VisualCustomisationType.MaterialChange) { //Cache values cached_target = FindTargetObject(VisualCustomisation.TargetedGameObjectName); cached_target_renderer = cached_target.GetComponent <Renderer>(); _maxOption = VisualCustomisation.MaterialPaths.Count - 1; } //Set Initial Value and initial colors _curOption = VisualCustomisation.StartingValueInt; SetOption(); }
public void Init(VisualCustomisation customisation) { VisualCustomisation = customisation; TitleText.text = VisualCustomisation.Identifier; if (VisualCustomisation.CustomisationType == VisualCustomisationType.MaterialColor) { //Spawn Objects ColorContainer.transform.DestroyChildren(); foreach (var colorOption in VisualCustomisation.ColorOptions) { var go = Instantiate(ColorSelectPrefab, Vector3.zero, Quaternion.identity) as GameObject; go.transform.SetParent(ColorContainer.transform, false); var colorSelectModel = go.GetComponent <VisualColorSelectModel>(); colorSelectModel.Init(this, colorOption); } //Cache values var targetGo = FindTargetObject(VisualCustomisation.TargetedGameObjectName); cached_target_renderer = targetGo.GetComponent <Renderer>(); //Set Initial Value and initial colors var startingValue = VisualCustomisation.ColorOptions[0]; SetColorOption(startingValue); } }
public void Init(VisualCustomisation customisation) { VisualCustomisation = customisation; TitleText.text = VisualCustomisation.Identifier; cached_targets = new List <GameObject>(); if (VisualCustomisation.CustomisationType == VisualCustomisationType.GameObject) { //Spawn Objects ImageContainer.transform.DestroyChildren(); for (int index = 0; index < VisualCustomisation.TargetedGameObjectNames.Count; index++) { var option = VisualCustomisation.TargetedGameObjectNames[index]; var go = Instantiate(ImageSelectPrefab, Vector3.zero, Quaternion.identity) as GameObject; go.transform.SetParent(ImageContainer.transform, false); var textSelectModel = go.GetComponent <VisualImageSelectModel>(); textSelectModel.Init(this, option, VisualCustomisation.ImageOptions[index]); } //Cache values VisualCustomisation.TargetedGameObjectNames.ForEach(t => cached_targets.Add(FindTargetObject(t))); //Set Initial Value and initial colors var startingValue = VisualCustomisation.TargetedGameObjectNames[VisualCustomisation.StartingValueInt]; SetTextOption(startingValue); } else if (VisualCustomisation.CustomisationType == VisualCustomisationType.MaterialChange) { //Spawn Objects ImageContainer.transform.DestroyChildren(); for (int index = 0; index < VisualCustomisation.MaterialPaths.Count; index++) { var option = VisualCustomisation.MaterialPaths[index]; var go = Instantiate(ImageSelectPrefab, Vector3.zero, Quaternion.identity) as GameObject; go.transform.SetParent(ImageContainer.transform, false); var textSelectModel = go.GetComponent <VisualImageSelectModel>(); textSelectModel.Init(this, option, VisualCustomisation.ImageOptions[index]); } //Cache values cached_target = FindTargetObject(VisualCustomisation.TargetedGameObjectName); cached_target_renderer = cached_target.GetComponent <Renderer>(); //Set Initial Value and initial colors var startingValue = VisualCustomisation.MaterialPaths[VisualCustomisation.StartingValueInt]; SetTextOption(startingValue); } }
//private SkinnedMeshRenderer targetRenderer; //private List<Material> targetMaterials; public void Init(VisualCustomisation customisation) { VisualCustomisation = customisation; TitleText.text = VisualCustomisation.Identifier; cached_targets = new List <GameObject>(); if (VisualCustomisation.CustomisationType == VisualCustomisationType.GameObject) { //Cache values VisualCustomisation.TargetedGameObjectNames.ForEach(t => cached_targets.Add(FindTargetObject(t))); //Set Initial Value and initial colors _curOption = 0; SetOption(); } }
public void Init(VisualCustomisation customisation) { VisualCustomisation = customisation; TitleText.text = VisualCustomisation.Identifier; if (VisualCustomisation.CustomisationType == VisualCustomisationType.BlendShape) { //Cache values cached_target = FindTargetObject(VisualCustomisation.TargetedGameObjectName); cached_target_skinnedMeshRender = cached_target.GetComponent <SkinnedMeshRenderer>(); cached_int_ref = cached_target_skinnedMeshRender.sharedMesh.GetBlendShapeIndex(VisualCustomisation.StringRef); //Set Initial Value var startingValue = VisualCustomisation.MinFloatValue; //Setup slider Slider.minValue = VisualCustomisation.MinFloatValue; Slider.maxValue = VisualCustomisation.MaxFloatValue; Slider.value = startingValue; } else if (VisualCustomisation.CustomisationType == VisualCustomisationType.Scale) { //Cache values cached_target = FindTargetObject(VisualCustomisation.TargetedGameObjectName); //Set Initial Value var startingValue = VisualCustomisation.MinFloatValue; //Setup slider Slider.minValue = VisualCustomisation.MinFloatValue; Slider.maxValue = VisualCustomisation.MaxFloatValue; Slider.value = startingValue; } //For all Slider.onValueChanged.AddListener(delegate { OnSliderValueChange(); }); OnSliderValueChange(); }