URL: http://atnd.org/events/34621
また僕の番が回って来ました。
シーンはこれですね。
Chainのときのに見た目が似てますが、これは1つ1つを待たずに次を行うようです。
これが実際のGameシーンです。
いつもどおり、uiというGameObjectに一番重要(使う人垣にする)なコードがアタッチされてあります。
コードを見てみましょう。
Unity Advent Calendar 2012 5日目 Title:「GoKit実践 シーン2. Tween Chain」とあまり変わりませんね。
・TweenFlowGUI.cs
using UnityEngine; using System.Collections; /// <summary> /// this demo is identical to the Tween Chain demo except that it uses a TweenFlow to show how you can overlap /// tweens with a TweenFlow /// </summary> public class TweenFlowGUI : BaseDemoGUI { // we have 4 cubes setup public Transform[] cubes; void Start () { // create a TweenConfig that we will use on all 4 cubes var config = new TweenConfig () .setEaseType (EaseType.QuadIn) // set the ease type for the tweens .materialColor (Color.magenta) // tween the material color to magenta .eulerAngles (new Vector3 (0, 360, 0)) // do a 360 rotation .position (new Vector3 (2, 8, 0), true) // relative position tween so it will be start from the current location .setIterations (2, LoopType.PingPong); // 2 iterations with a PingPong loop so we go out and back; // ※2回繰り返すことはChainと同じだが、TweenFlowクラスを使う var flow = new TweenFlow ().setIterations (2); // add a completion handler for the chain flow.setOnCompleteHandler (c => Debug.Log ("flow complete")); // create a Tween for each cube and it to the flow var startTime = 0f; foreach (var cube in cubes) { var tween = new Tween (cube, 0.5f, config); flow.insert (startTime, tween); // ※ここがChainと違う 次のCUべのスタート時間を0.25遅らせる処理。 startTime += 0.25f; } _tween = flow; } }
Demoは残り2シーンとなりました。
次回は「4. Path Tween」です。
ネタなくなったら何をかこうかしら??