public void AnimScaleTo(Vector3 scale, float time, MadiTween.EaseType easing) { MadiTween.ScaleTo(gameObject, MadiTween.Hash( "scale", scale, "time", time, "easetype", easing )); }
protected Vector2 Ease(MadiTween.EaseType type, Vector2 start, Vector2 end, float percentage) { var fun = MadiTween.GetEasingFunction(type); float x = fun(start.x, end.x, percentage); float y = fun(start.y, end.y, percentage); return(new Vector2(x, y)); }
public void AnimRotateTo(Vector3 rotation, float time, MadiTween.EaseType easing) { MadiTween.RotateTo(gameObject, MadiTween.Hash( "rotation", rotation, "time", time, "easetype", easing, "islocal", true )); }
public void AnimMoveTo(Vector3 target, float time, MadiTween.EaseType easing) { MadiTween.MoveTo(gameObject, MadiTween.Hash( "position", target, "time", time, "easetype", easing, "islocal", true )); }
public void AnimColorTo(Color color, float time, MadiTween.EaseType easing) { MadiTween.ValueTo(gameObject, MadiTween.Hash( "from", tint, "to", color, "time", time, "onupdate", "OnTintChange", "easetype", easing )); }
public void LookAtLevel(string levelName, MadiTween.EaseType easeType, float time) { var icon = GetIcon(levelName); if (icon != null) { LookAtIcon(icon, easeType, time); } else { Debug.LogError("No icon found for level '" + levelName + "'"); } }
public void MoveToLocal(Vector2 position, MadiTween.EaseType easeType, float time) { if (time == 0) { cameraPos = MadMath.ClosestPoint(dragBounds, position); moveAnim = false; } else { moveAnimStartPosition = cachedCamPos; moveAnimEndPosition = position; moveAnimStartTime = Time.time; moveAnimDuration = time; moveAnimEaseType = easeType; moveAnim = true; } }
// =========================================================== // Methods // =========================================================== #region Public API public void LookAtIcon(MadLevelIcon icon, MadiTween.EaseType easeType, float time) { draggable.MoveToLocal(icon.transform.localPosition, easeType, time); }
public void AnimColor(Color from, Color to, float time, MadiTween.EaseType easing) { tint = from; AnimColorTo(to, time, easing); }
public void AnimRotate(Vector3 from, Vector3 to, float time, MadiTween.EaseType easing) { transform.localScale = from; AnimScaleTo(to, time, easing); }
public void AnimMove(Vector3 from, Vector3 to, float time, MadiTween.EaseType easing) { transform.localPosition = from; AnimMoveTo(to, time, easing); }
//grab and set generic, neccesary iTween arguments: void RetrieveArgs(){ foreach (Hashtable item in tweens) { if((GameObject)item["target"] == gameObject){ tweenArguments=item; break; } } id=(string)tweenArguments["id"]; type=(string)tweenArguments["type"]; /* GFX47 MOD START */ _name=(string)tweenArguments["name"]; /* GFX47 MOD END */ method=(string)tweenArguments["method"]; if(tweenArguments.Contains("time")){ time=(float)tweenArguments["time"]; }else{ time=Defaults.time; } //do we need to use physics, is there a rigidbody? if(GetComponent<Rigidbody>() != null){ physics=true; } if(tweenArguments.Contains("delay")){ delay=(float)tweenArguments["delay"]; }else{ delay=Defaults.delay; } if(tweenArguments.Contains("namedcolorvalue")){ //allows namedcolorvalue to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["namedcolorvalue"].GetType() == typeof(NamedValueColor)){ namedcolorvalue=(NamedValueColor)tweenArguments["namedcolorvalue"]; }else{ try { namedcolorvalue=(NamedValueColor)Enum.Parse(typeof(NamedValueColor),(string)tweenArguments["namedcolorvalue"],true); } catch { Debug.LogWarning("iTween: Unsupported namedcolorvalue supplied! Default will be used."); namedcolorvalue = MadiTween.NamedValueColor._Color; } } }else{ namedcolorvalue=Defaults.namedColorValue; } if(tweenArguments.Contains("looptype")){ //allows loopType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["looptype"].GetType() == typeof(LoopType)){ loopType=(LoopType)tweenArguments["looptype"]; }else{ try { loopType=(LoopType)Enum.Parse(typeof(LoopType),(string)tweenArguments["looptype"],true); } catch { Debug.LogWarning("iTween: Unsupported loopType supplied! Default will be used."); loopType = MadiTween.LoopType.none; } } }else{ loopType = MadiTween.LoopType.none; } if(tweenArguments.Contains("easetype")){ //allows easeType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["easetype"].GetType() == typeof(EaseType)){ easeType=(EaseType)tweenArguments["easetype"]; }else{ try { easeType=(EaseType)Enum.Parse(typeof(EaseType),(string)tweenArguments["easetype"],true); } catch { Debug.LogWarning("iTween: Unsupported easeType supplied! Default will be used."); easeType=Defaults.easeType; } } }else{ easeType=Defaults.easeType; } if(tweenArguments.Contains("space")){ //allows space to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["space"].GetType() == typeof(UnityEngine.Space)){ space=(UnityEngine.Space)tweenArguments["space"]; }else{ try { space=(UnityEngine.Space)Enum.Parse(typeof(UnityEngine.Space),(string)tweenArguments["space"],true); } catch { Debug.LogWarning("iTween: Unsupported space supplied! Default will be used."); space = Defaults.space; } } }else{ space = Defaults.space; } if(tweenArguments.Contains("islocal")){ isLocal = (bool)tweenArguments["islocal"]; }else{ isLocal = Defaults.isLocal; } // Added by PressPlay if (tweenArguments.Contains("ignoretimescale")) { useRealTime = (bool)tweenArguments["ignoretimescale"]; } else { useRealTime = Defaults.useRealTime; } //instantiates a cached ease equation reference: ease = GetEasingFunction(easeType); }