예제 #1
0
    public void D()
    {
        var action = CCAction.CCSequence(
            CCAction.CCDelay(0, () => { Debug.Log("HelloWorld"); }),                     //回调
            gameObject.CCShow(),                                                         //显示
            transform.CCMoveTo(1.0f, new Vector3(100, 100, 100)),                        //移动
            CCAction.CCSineEaseIn(image.transform.CCMoveTo(1.0f, new Vector3(0, 0, 0))), //变速(In先慢后快) 移动
            CCAction.CCSpawn(
                transform.CCAnglesTo(1.0f, new Vector3(0, 0, 360)),
                transform.CCScaleTo(0.8f, new Vector3(2, 2, 2))
                ),                                         // 并行执行 旋转和缩放,取最长时间作为结束时间
            transform.CCScaleTo(1f, new Vector3(1, 1, 1)), //缩放
            CCActionDelay.Create(0f)
            );

        CCAction.Do(action, transform, 3);  //执行Action,并且循环3次,小于0无限循环
    }
예제 #2
0
    public ActionInterval OnClick20()
    {
        var action1 = CCAction.CCSequence(
            CCAction.CCDelay(0, () => { Reset(); SetTile("图一浮动、图二震动"); }),
            image2.gameObject.CCShow(),
            CCAction.CCSineEaseIn(image.transform.CCMoveTo(duration * 0.5f, new Vector3(0, 100, 0))),
            CCAction.CCSineEaseOut(image.transform.CCMoveTo(duration * 0.5f, new Vector3(0, 0, 0))),
            CCActionDelay.Create(0f)
            );
        var action2 = CCAction.CCSequence(
            image2.transform.CCShake(duration, new Vector3(20, 20, 0)),
            image2.transform.CCMoveTo(0, new Vector3(0, -100, 0)),
            CCActionDelay.Create(0f)
            );
        var action = CCActionSpawn.Create(action1, action2);

        return(CCAction.CCRepeat(action, 3));
    }