public AnimInfoBase(GameObject obj, object target, ParamType paramType, AnimType animType, float factor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) { Object = obj; Param = paramType; Anim = animType; Target = target; initialValue_ = initValue; Factor = factor; Delay = delay; EndOption = endOption; normalizedValue_ = 0; animValue_ = 0; if (Target is int) { int intTarget = (int)Target; Target = (float)intTarget; } if (Delay <= 0) { OnStartAnim(); } }
public static void AddShakeAnim(Object obj, float range, float time, float updateTime, ParamType paramType, AnimType animType = AnimType.Time, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None) { GameObject gameObject = ToGameObject(obj); Instance.Animations.Add(new ShakeAnimInfo(gameObject, range, time, updateTime, paramType, animType, delay, endOption)); }
public static void AddAnim(Object obj, object target, ParamType paramType, AnimType animType = AnimType.Linear, float timeFactor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) { GameObject gameObject = ToGameObject(obj); switch (paramType) { case ParamType.Scale: case ParamType.ScaleX: case ParamType.ScaleY: case ParamType.ScaleZ: case ParamType.RotationZ: case ParamType.Position: case ParamType.PositionX: case ParamType.PositionY: case ParamType.PositionZ: Instance.Animations.Add(new TransformAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.SizeDeltaX: case ParamType.SizeDeltaY: case ParamType.AnchoredPositionX: case ParamType.AnchoredPositionY: Instance.Animations.Add(new RectTransformAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.PrimitiveRadius: case ParamType.PrimitiveWidth: case ParamType.PrimitiveArc: Instance.Animations.Add(new PrimitiveAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.GaugeLength: case ParamType.GaugeRate: case ParamType.GaugeWidth: Instance.Animations.Add(new GaugeAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.Color: case ParamType.AlphaColor: Instance.Animations.Add(new ColorAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.TextColor: case ParamType.TextAlphaColor: Instance.Animations.Add(new TextAnimInfo(gameObject, target, paramType, animType, timeFactor, delay, endOption, initValue)); break; case ParamType.Any: break; default: print("unknown anim type!"); break; } }
public ShakeAnimInfo(GameObject obj, float range, float time, float updateTime, ParamType paramType, AnimType animType, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None) : base(obj, range, paramType, animType, time, delay, endOption) { if (paramType < ParamType.Position || ParamType.PositionZ < paramType) { throw new System.Exception("ShakeAnimInfo: wrong param type! paramType = " + paramType.ToString()); } timer_ = 0; updateTime_ = updateTime; }
public TextAnimInfo(GameObject obj, object target, ParamType paramType, AnimType animType, float factor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) : base(obj, target, paramType, animType, factor, delay, endOption, initValue) { if (paramType != ParamType.TextColor && paramType != ParamType.TextAlphaColor) { throw new System.Exception("TextAnimInfo: wrong param type! paramType = " + paramType.ToString()); } }
public GaugeAnimInfo(GameObject obj, object target, ParamType paramType, AnimType animType, float factor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) : base(obj, target, paramType, animType, factor, delay, endOption, initValue) { if (paramType < ParamType.GaugeLength || ParamType.GaugeWidth < paramType) { throw new System.Exception("GaugeAnimInfo: wrong param type! paramType = " + paramType.ToString()); } }
public RectTransformAnimInfo(GameObject obj, object target, ParamType paramType, AnimType animType, float factor = 0.1f, float delay = 0.0f, AnimEndOption endOption = AnimEndOption.None, object initValue = null) : base(obj, target, paramType, animType, factor, delay, endOption, initValue) { if (paramType < ParamType.SizeDeltaX || ParamType.AnchoredPositionY < paramType) { throw new System.Exception("RectTransformAnimInfo: wrong param type! paramType = " + paramType.ToString()); } }