16 [Tooltip(
"tag for the color button theme")]
17 public string ColorThemeTag =
"defaultColor";
19 [Tooltip(
"tag for the position button theme")]
20 public string PositionThemeTag =
"defaultPosition";
22 [Tooltip(
"tag for the scale button theme")]
23 public string ScaleThemeTag =
"defaultScale";
25 [Tooltip(
"Color transition animation component: optional")]
28 [Tooltip(
"position animation component: optional")]
31 [Tooltip(
"scale animation component: optional")]
40 private Material mMaterial;
42 private string mCheckColorThemeTag =
"";
43 private string mCheckPositionThemeTag =
"";
44 private string mCheckScaleThemeTag =
"";
51 if (ColorBlender == null)
53 ColorBlender = GetComponent<ColorTransition>();
56 if (MovePosition == null)
58 MovePosition = GetComponent<MoveToPosition>();
61 if (ScaleSize == null)
63 ScaleSize = GetComponent<ScaleToValue>();
67 Renderer renderer = GetComponent<Renderer>();
70 mMaterial = renderer.material;
82 if (ColorThemeTag !=
"")
84 mColorTheme = GetColorTheme(ColorThemeTag);
85 mCheckColorThemeTag = ColorThemeTag;
88 if (PositionThemeTag !=
"")
90 mPositionTheme = GetVector3Theme(PositionThemeTag);
91 mCheckPositionThemeTag = PositionThemeTag;
94 if (ScaleThemeTag !=
"")
96 mScaleTheme = GetVector3Theme(ScaleThemeTag);
97 mCheckScaleThemeTag = ScaleThemeTag;
107 base.SetState(state);
109 if (mColorTheme != null)
111 if (ColorBlender != null)
115 else if(mMaterial != null)
121 if (mPositionTheme != null)
123 if (MovePosition != null)
130 transform.localPosition = mPositionTheme.
GetThemeValue(state);
134 if (mScaleTheme != null)
136 if (ScaleSize != null)
148 private void Update()
150 if(!mCheckScaleThemeTag.Equals(ScaleThemeTag) || !mCheckPositionThemeTag.Equals(PositionThemeTag) || !mCheckColorThemeTag.Equals(ColorThemeTag))
160 private void OnDestroy()
162 if(mMaterial != null)
164 GameObject.Destroy(mMaterial);