public static void ScaleUpdate(GameObject target, Hashtable args)
{
CleanArgs(args);
float time;
Vector3[] vector3s = new Vector3[4];
//set smooth time:
if(args.Contains("time")){
time=(float)args["time"];
time*=Defaults.updateTimePercentage;
}else{
time=Defaults.updateTime;
}
//init values:
vector3s[0] = vector3s[1] = target.transform.localScale;
//to values:
if (args.Contains("scale")) {
if (args["scale"].GetType() == typeof(Transform)){
Transform trans = (Transform)args["scale"];
vector3s[1]=trans.localScale;
}else if(args["scale"].GetType() == typeof(Vector3)){
vector3s[1]=(Vector3)args["scale"];
}
}else{
if (args.Contains("x")) {
vector3s[1].x=(float)args["x"];
}
if (args.Contains("y")) {
vector3s[1].y=(float)args["y"];
}
if (args.Contains("z")) {
vector3s[1].z=(float)args["z"];
}
}
//calculate:
vector3s[3].x=Mathf.SmoothDamp(vector3s[0].x,vector3s[1].x,ref vector3s[2].x,time);
vector3s[3].y=Mathf.SmoothDamp(vector3s[0].y,vector3s[1].y,ref vector3s[2].y,time);
vector3s[3].z=Mathf.SmoothDamp(vector3s[0].z,vector3s[1].z,ref vector3s[2].z,time);
//apply:
target.transform.localScale=vector3s[3];
}