fork(1) download
  1. //----------------------------------------------
  2. // NGUI: Next-Gen UI kit
  3. // Copyright © 2011-2012 Tasharen Entertainment
  4. //----------------------------------------------
  5.  
  6. using UnityEngine;
  7.  
  8. /// <summary>
  9. /// Tween the object's alpha.
  10. /// </summary>
  11.  
  12. [AddComponentMenu("NGUI/Tween/Alpha")]
  13. public class TweenAlpha : UITweener
  14. {
  15. public float from = 1f;
  16. public float to = 1f;
  17.  
  18. Transform mTrans;
  19. UIWidget mWidget;
  20.  
  21. /// <summary>
  22. /// Current alpha.
  23. /// </summary>
  24.  
  25. public float alpha { get { return mWidget.alpha; } set { mWidget.alpha = value; } }
  26.  
  27. /// <summary>
  28. /// Find all needed components.
  29. /// </summary>
  30.  
  31. void Awake () { mWidget = GetComponentInChildren<UIWidget>(); }
  32.  
  33. /// <summary>
  34. /// Interpolate and update the alpha.
  35. /// </summary>
  36.  
  37. override protected void OnUpdate (float factor, bool isFinished) { alpha = Mathf.Lerp(from, to, factor); }
  38.  
  39. /// <summary>
  40. /// Start the tweening operation.
  41. /// </summary>
  42.  
  43. static public TweenAlpha Begin (GameObject go, float duration, float alpha)
  44. {
  45. TweenAlpha comp = UITweener.Begin<TweenAlpha>(go, duration);
  46. comp.from = comp.alpha;
  47. comp.to = alpha;
  48. return comp;
  49. }
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(6,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(18,9): error CS0246: The type or namespace name `Transform' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(19,9): error CS0246: The type or namespace name `UIWidget' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(37,33): error CS0115: `TweenAlpha.OnUpdate(float, bool)' is marked as an override but no suitable method found to override
prog.cs(12,2): error CS0246: The type or namespace name `AddComponentMenu' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(12,2): error CS0246: The type or namespace name `AddComponentMenuAttribute' could not be found. Are you missing a using directive or an assembly reference?
prog.cs(43,41): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 7 error(s), 0 warnings
stdout
Standard output is empty