public static void Parse(string parameter, out float speed) { int idx = 0; string[] parameters = parameter.Split(','); speed = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; }
public static void Parse(string parameter, out float fadeTime) { int idx = 0; string[] parameters = parameter.Split(','); fadeTime = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 0f); ++idx; }
public static void Parse(string parameter, out string effectName, out string parentGameObjectName) { int idx = 0; string[] parameters = parameter.Split(','); effectName = StrParser.ParseStr(parameters.Length > idx ? parameters[idx] : null, ""); ++idx; parentGameObjectName = StrParser.ParseStr(parameters.Length > idx ? parameters[idx] : null, ""); ++idx; }
public static void Parse(string parameter, out string audioName, out float delay, out float fadeTime) { int idx = 0; string[] parameters = parameter.Split(','); audioName = StrParser.ParseStr(parameters.Length > idx ? parameters[idx] : null, ""); ++idx; delay = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; fadeTime = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 0f); ++idx; }
public static void Parse(string parameter, out string soundName, out float volume, out float delay) { int idx = 0; string[] parameters = parameter.Split(','); soundName = StrParser.ParseStr(parameters.Length > idx ? parameters[idx] : null, ""); ++idx; volume = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; delay = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 0f); ++idx; }
public static void Parse(string parameter, out float intensity, out float duration, out float interval) { int idx = 0; string[] parameters = parameter.Split(','); intensity = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; duration = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; interval = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; }
public static void Parse(string parameter, out float intensity, out float duration, out float interval, out bool shakeOnlyVisible) { int idx = 0; string[] parameters = parameter.Split(','); intensity = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; duration = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; interval = StrParser.ParseFloat(parameters.Length > idx ? parameters[idx] : null, 1f); ++idx; shakeOnlyVisible = StrParser.ParseBool(parameters.Length > idx ? parameters[idx] : null, false); ++idx; }
//#if UNITY_PRO_LICENSE public static UnityEngine.Vector2 ParseVector2(string str) { var vector2 = default(UnityEngine.Vector2); string[] vecs = str.Split(splitter); if (vecs.Length < 2) return vector2; vector2.x = StrParser.ParseFloat(vecs[0], 0); vector2.y = StrParser.ParseFloat(vecs[1], 0); return vector2; }
public static UnityEngine.Vector3 ParseVector3(string str) { var vector3 = default(UnityEngine.Vector3); str = str.TrimStart('('); str = str.TrimEnd(')'); string[] vecs = str.Split(splitter); if (vecs.Length < 3) return vector3; vector3.x = StrParser.ParseFloat(vecs[0], 0); vector3.y = StrParser.ParseFloat(vecs[1], 0); vector3.z = StrParser.ParseFloat(vecs[2], 0); return vector3; }
//#endif /// <summary> /// default is black /// </summary> public static UnityEngine.Color ParseColor(string str) { UnityEngine.Color res = new UnityEngine.Color(1f, 1f, 1f, 0.3f); if (str == null) return res; //RGBA(r,g,b,a) str = str.Substring(5, str.Length - 6); string[] vecs = str.Split(splitter); if (vecs.Length < 4) return res; res.r = StrParser.ParseFloat(vecs[0], 0); res.g = StrParser.ParseFloat(vecs[1], 0); res.b = StrParser.ParseFloat(vecs[2], 0); res.a = StrParser.ParseFloat(vecs[3], 0); return res; }