/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, float pixelsToUnits, float skipSpeed, Action <AdvTweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) { return; } this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.HashObjects.ToArray()); //2D座標にあわせる if (iTweenData.IsPostionType(data.Type)) { if (hashTbl.ContainsKey("x")) { hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; } if (hashTbl.ContainsKey("y")) { hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; } if (hashTbl.ContainsKey("z")) { hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) { hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; } bool isTime = hashTbl.ContainsKey("time"); if (isTime) { hashTbl["time"] = (float)hashTbl["time"] / skipSpeed; } else if (!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.graphicObject = this.gameObject.GetComponent <AdvGraphicObject>(); if (graphicObject != null) { Color currentColor = graphicObject.EffectColors.GetColor(EffectColors.Index.TweenColor); if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnComplete"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, float pixelsToUnits, float skipSpeed, Action<AdvTweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) return; this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.HashObjects.ToArray()); //2D座標にあわせる if (iTweenData.IsPostionType(data.Type)) { if (hashTbl.ContainsKey("x")) hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; if (hashTbl.ContainsKey("y")) hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; if (hashTbl.ContainsKey("z")) hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; bool isTime = hashTbl.ContainsKey("time"); if(isTime) { hashTbl["time"] = (float)hashTbl["time"]/ skipSpeed; } else if(!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.graphicObject = this.gameObject.GetComponent<AdvGraphicObject>(); if (graphicObject != null) { Color currentColor = graphicObject.EffectColors.GetColor(EffectColors.Index.TweenColor); if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnComplete"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
/// <summary> /// 初期化 /// </summary> /// <param name="type">Tweenのデータ</param> /// <param name="hashObjects">Tweenのパラメーター</param> /// <param name="loopCount">ループ回数</param> /// <param name="pixelsToUnits">座標1.0単位辺りのピクセル数</param> /// <param name="skipSpeed">スキップ中の演出速度の倍率。0ならスキップなし</param> /// <param name="callbackComplete">終了時に呼ばれるコールバック</param> public void Init(iTweenData data, bool isUnder2DSpace, float pixelsToUnits, float skipSpeed, bool unscaled, Action <AdvITweenPlayer> callbackComplete) { this.data = data; if (data.Type == iTweenType.Stop) { return; } this.callbackComplete = callbackComplete; data.ReInit(); hashTbl = iTween.Hash(data.MakeHashArray()); if (iTweenData.IsPostionType(data.Type)) { //座標系の処理は、基本的に2D座標の値で入力されているので、 //非ローカルの場合や、2D座標じゃない場合は、pixelsToUnitsで3D座標値に変換する if (!isUnder2DSpace || (!hashTbl.ContainsKey("islocal") || (bool)hashTbl["islocal"] == false)) { if (hashTbl.ContainsKey("x")) { hashTbl["x"] = (float)hashTbl["x"] / pixelsToUnits; } if (hashTbl.ContainsKey("y")) { hashTbl["y"] = (float)hashTbl["y"] / pixelsToUnits; } if (hashTbl.ContainsKey("z")) { hashTbl["z"] = (float)hashTbl["z"] / pixelsToUnits; } } } //スキップ中なら演出時間を調整 if (skipSpeed > 0) { bool isSpeed = hashTbl.ContainsKey("speed"); if (isSpeed) { hashTbl["speed"] = (float)hashTbl["speed"] * skipSpeed; } bool isTime = hashTbl.ContainsKey("time"); if (isTime) { hashTbl["time"] = (float)hashTbl["time"] / skipSpeed; } else if (!isSpeed) { hashTbl["time"] = 1.0f / skipSpeed; } } //カラーの処理を2D仕様に if (data.Type == iTweenType.ColorTo || data.Type == iTweenType.ColorFrom) { this.target = this.gameObject.GetComponent <AdvEffectColor>(); if (target != null) { Color currentColor = target.TweenColor; if (data.Type == iTweenType.ColorTo) { hashTbl["from"] = currentColor; hashTbl["to"] = ParaseTargetColor(hashTbl, currentColor); } else if (data.Type == iTweenType.ColorFrom) { hashTbl["from"] = ParaseTargetColor(hashTbl, currentColor); hashTbl["to"] = currentColor; } hashTbl["onupdate"] = "OnColorUpdate"; isColorSprite = true; } } //時間をタイムスケールに比例させない if (unscaled) { hashTbl["ignoretimescale"] = true; } //終了時に呼ばれるメッセージを登録 hashTbl["oncomplete"] = "OnCompleteTween"; hashTbl["oncompletetarget"] = this.gameObject; hashTbl["oncompleteparams"] = this; //停止処理用に名前を設定 tweenName = this.GetHashCode().ToString(); hashTbl["name"] = tweenName; }
public void Init(iTweenData data, bool isUnder2DSpace, float pixelsToUnits, float skipSpeed, Action <AdvITweenPlayer> callbackComplete) { this.data = data; if (data.Type != iTweenType.Stop) { this.callbackComplete = callbackComplete; data.ReInit(); this.hashTbl = iTween.Hash(data.MakeHashArray()); if (iTweenData.IsPostionType(data.Type) && ((!isUnder2DSpace || !this.hashTbl.ContainsKey("islocal")) || !((bool)this.hashTbl["islocal"]))) { if (this.hashTbl.ContainsKey("x")) { this.hashTbl["x"] = ((float)this.hashTbl["x"]) / pixelsToUnits; } if (this.hashTbl.ContainsKey("y")) { this.hashTbl["y"] = ((float)this.hashTbl["y"]) / pixelsToUnits; } if (this.hashTbl.ContainsKey("z")) { this.hashTbl["z"] = ((float)this.hashTbl["z"]) / pixelsToUnits; } } if (skipSpeed > 0f) { bool flag = this.hashTbl.ContainsKey("speed"); if (flag) { this.hashTbl["speed"] = ((float)this.hashTbl["speed"]) * skipSpeed; } if (this.hashTbl.ContainsKey("time")) { this.hashTbl["time"] = ((float)this.hashTbl["time"]) / skipSpeed; } else if (!flag) { this.hashTbl["time"] = 1f / skipSpeed; } } if ((data.Type == iTweenType.ColorTo) || (data.Type == iTweenType.ColorFrom)) { this.target = base.get_gameObject().GetComponent <AdvEffectColor>(); if (this.target != null) { Color tweenColor = this.target.TweenColor; if (data.Type == iTweenType.ColorTo) { this.hashTbl["from"] = tweenColor; this.hashTbl["to"] = this.ParaseTargetColor(this.hashTbl, tweenColor); } else if (data.Type == iTweenType.ColorFrom) { this.hashTbl["from"] = this.ParaseTargetColor(this.hashTbl, tweenColor); this.hashTbl["to"] = tweenColor; } this.hashTbl["onupdate"] = "OnColorUpdate"; this.isColorSprite = true; } } this.hashTbl["oncomplete"] = "OnCompleteTween"; this.hashTbl["oncompletetarget"] = base.get_gameObject(); this.hashTbl["oncompleteparams"] = this; this.tweenName = this.GetHashCode().ToString(); this.hashTbl["name"] = this.tweenName; } }