コード例 #1
0
        private void Start()
        {
            this.Sequence()
            .Delay(1.0f)
            .Event(() => Log.I("Sequence1 延时了 1s"))
            .Begin()
            .OnDisposed(() => { Log.I("Sequence1 destroyed"); });

            var sequenceNode2 = new SequenceNode(DelayAction.Allocate(1.5f));

            sequenceNode2.Append(EventAction.Allocate(() => Log.I("Sequence2 延时 1.5s")));
            sequenceNode2.Append(DelayAction.Allocate(0.5f));
            sequenceNode2.Append(EventAction.Allocate(() => Log.I("Sequence2 延时 2.0s")));

            this.ExecuteNode(sequenceNode2);

            /* 这种方式需要自己手动进行销毁
             * sequenceNode2.Dispose();
             * sequenceNode2 = null;
             */

            // 或者 OnDestroy 触发时进行销毁
            sequenceNode2.DisposeWhenGameObjectDestroyed(this);
        }