Exemplo n.º 1
0
    ActionInterval GetAllActions(int count)
    {
        ActionInterval action = null;

        for (int i = 0; i < count; i++)
        {
            Type   tp         = typeof(ActionTest);
            var    methodInfo = tp.GetMethod($"OnClick{i + 1}");
            object o          = methodInfo.Invoke(this, new System.Object[] { });
            if (o == null)
            {
                break;
            }
            var action2 = o as ActionInterval;
            if (action == null)
            {
                action = action2;
            }
            else
            {
                action = CCAction.CCSequence(action, action2);
            }
        }
        return(action);
    }
Exemplo n.º 2
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无限循环
    }
Exemplo n.º 3
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));
    }
Exemplo n.º 4
0
    public ActionInterval OnClick19()
    {
        var action1 = CCAction.CCSequence(
            CCAction.CCDelay(0, () => { Reset(); SetTile("获得奖励效果"); }),

            image.transform.CCMoveTo(0, new Vector3(0, 200, 0)),
            image.transform.CCMoveTo(duration * 0.3f, new Vector3(0, 0, 0)),
            CCActionDelay.Create(0f)
            );
        var action2 = CCAction.CCSequence(
            image.transform.CCScaleTo(0, new Vector3(3, 3, 3)),
            image.transform.CCScaleTo(duration * 0.3f, new Vector3(0.5f, 0.5f, 0.5f)),
            image.transform.CCScaleTo(duration * 0.2f, new Vector3(1.3f, 1.3f, 1.3f)),
            image.transform.CCScaleTo(duration * 0.15f, new Vector3(1, 1, 1)),
            CCActionDelay.Create(0.2f),
            CCActionDelay.Create(0f)
            );
        var action = CCActionSpawn.Create(action1, action2);

        return(CCAction.CCRepeat(action, 3));
    }
Exemplo n.º 5
0
 public ActionInterval OnClick9()
 {
     return(CCAction.CCSequence(
                CCAction.CCDelay(0, () => { Reset(); SetTile("闪烁5次"); }),
                image.gameObject.CCBlink(duration, 5)));
 }