moveLocalX() public static method

public static moveLocalX ( GameObject gameObject, float to, float time ) : LTDescr,
gameObject GameObject
to float
time float
return LTDescr,
Beispiel #1
0
    /// <summary>
    /// This method repaints the entire graph.
    /// </summary>
    public void Repaint()
    {
        HideCurrentPointInformationPanel();

        // delete all circles and lines
        for (int i = 0; i < graphLines.transform.childCount; i++)
        {
            Object.Destroy(graphLines.transform.GetChild(i).gameObject);
        }
        for (int i = 0; i < graphCircles.transform.childCount; i++)
        {
            Object.Destroy(graphCircles.transform.GetChild(i).gameObject);
        }
        lines   = new List <Image>();
        circles = new List <RectTransform>();

        RectTransform rt = scrollContent.GetComponent <RectTransform>();

        rt.sizeDelta = scrollView.GetComponent <RectTransform>().sizeDelta;

        // reset the distance that corresponds to one unit of x and the ui coordinate system
        minWidthPerUnit = scrollContent.GetComponent <RectTransform>().sizeDelta.x / xMax;
        // reset the width scale on the x axis to the width at beginning (is changing over the time)
        widthPerUnit = scrollContent.GetComponent <RectTransform>().sizeDelta.x;

        // update the width per unit on the x axis
        UpdateWidthPerUnit(false);

        // delete all x info texts and legder lines
        for (int i = 0; i < xLedgerPanel.transform.childCount; i++)
        {
            Destroy(xLedgerPanel.transform.GetChild(i).gameObject);
        }
        for (int i = 0; i < xAxisPanel.transform.childCount; i++)
        {
            Destroy(xAxisPanel.transform.GetChild(i).gameObject);
        }

        xTexts = new List <Text>();
        xLines = new List <RectTransform>();

        // create all the x ledger line and info texts again
        float xStep = scrollView.GetComponent <RectTransform>().sizeDelta.x / (float)(xLedgerLines + 1);

        for (int i = 0; i < xLedgerLines; i++)
        {
            // calculate the position of the text info and the ledger line
            Vector2 pos = new Vector2(xStep * (i + 1) - xAxisPanel.GetComponent <RectTransform>().sizeDelta.x / 2, 0);
            // create the info text and ledger line
            AddXInfo(pos.x);
        }

        // reset the y info texts
        for (int i = 0; i < yTexts.Count; i++)
        {
            yTexts[i].GetComponent <Text>().text = "";
        }

        // reset the average line
        averageLine.gameObject.SetActive(false);

        // get the points of the statistics
        Point[] points = new Point[statistics.GetPoints().Count];
        statistics.GetPoints().CopyTo(points);

        // make the statistics not to store the points, as it already has them
        statistics.SetRecoveringState(true);

        // delete all the points from the statistics
        statistics.Clear();

        // add the points to the statistics again, so OnPointAdded is called again and the graph is repainted
        statistics.AddPoints(new List <Point>(points));

        // make the graph store all the data again
        statistics.SetRecoveringState(false);

        // reposition the first circle, as this circle is positioned wrong at first
        circles[0].localPosition = GetPositionFromPoint(statistics.GetPoints()[0]);

        UpdateYInfoText();
        // update the first x info texts
        UpdateXInfoTextFullShown(xMax / (float)(xLedgerLines + 1));

        // reposition the scroll content to the very right
        float scrollViewWidth = scrollView.GetComponent <RectTransform>().sizeDelta.x;
        float x = circles[circles.Count - 1].localPosition.x + scrollViewWidth / 2 + circleRadius / 2;

        LeanTween.moveLocalX(scrollContent.gameObject, -(1.5f * x - scrollViewWidth), 0.1f);

        // stop the content view if it is moving
        scrollView.GetComponent <ScrollRect>().velocity = Vector2.zero;
    }
 public void EnterTime()
 {
     LeanTween.moveLocalX(timeText, 0f, 0.5f).setEase(LeanTweenType.easeOutBack).setOnComplete(EnterSlime);
 }
Beispiel #3
0
    void Update()
    {
        LeanTween.dtManual = Time.deltaTime;
        if (Input.GetKeyDown(KeyCode.Q))
        {
            //LeanTween.scale(this.gameObject, Vector3.one*3f, 1.0f).setEase(LeanTweenType.easeSpring).setUseManualTime(true);
            //print("scale punch time independent!");

            LeanTween.moveLocalX(gameObject, 5, 1).setOnComplete(() => {
                Debug.Log("on complete move local X");
            }).setOnCompleteOnStart(true);

            GameObject light = GameObject.Find("DirectionalLight");
            Light      lt    = light.GetComponent <Light>();

            LeanTween.value(lt.gameObject, lt.intensity, 0.0f, 1.5f)
            .setEase(LeanTweenType.linear)
            .setLoopPingPong()
            .setRepeat(-1)
            .setOnUpdate((float val) => {
                lt.intensity = val;
            });
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            print("scale punch!");

            tweenStatically(this.gameObject);

            LeanTween.scale(this.gameObject, new Vector3(1.15f, 1.15f, 1.15f), 0.6f);

            LeanTween.rotateAround(this.gameObject, Vector3.forward, -360f, 0.3f).setOnComplete(() =>
            {
                LeanTween.rotateAround(this.gameObject, Vector3.forward, -360f, 0.4f).setOnComplete(() =>
                {
                    LeanTween.scale(this.gameObject, new Vector3(1f, 1f, 1f), 0.1f);

                    LeanTween.value(this.gameObject, (v) =>
                    {
                    }, 0, 1, 0.3f).setDelay(1);
                });
            });
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            Vector3[] pts = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f) };
            descr = LeanTween.move(gameObject, pts, 15f).setOrientToPath(true).setDirection(1f).setOnComplete(() => {
                Debug.Log("move path finished");
            });
        }

        if (Input.GetKeyDown(KeyCode.Y)) // Reverse the move path
        {
            descr.setDirection(-descr.direction);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            // LeanTween.rotate(this.gameObject, Vector3.one, 1.0f).setEase(LeanTweenType.punch);
            LeanTween.rotateAroundLocal(this.gameObject, this.transform.forward, -80f, 5.0f).setPoint(new Vector3(1.25f, 0f, 0f));
            print("rotate punch!");
        }

        if (Input.GetKeyDown(KeyCode.M))
        {
            // LeanTween.move(this.gameObject, new Vector3(0f,0f,1f), 1.0f).setEase(LeanTweenType.punch);
            print("move punch!");
            Time.timeScale = 0.25f;
            float start = Time.realtimeSinceStartup;
            LeanTween.moveX(this.gameObject, 1f, 1f).setOnComplete(destroyOnComp).setOnCompleteParam(this.gameObject).setOnComplete(() => {
                float end  = Time.realtimeSinceStartup;
                float diff = end - start;
                Debug.Log("start:" + start + " end:" + end + " diff:" + diff + " x:" + this.gameObject.transform.position.x);
            }).setEase(LeanTweenType.easeInBack).setOvershoot(overShootValue).setPeriod(0.3f);
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            LeanTween.color(this.gameObject, new Color(1f, 0f, 0f, 0.5f), 1f);

            Color      to = new Color(Random.Range(0f, 1f), 0f, Random.Range(0f, 1f), 0.0f);
            GameObject l  = GameObject.Find("LCharacter");
            LeanTween.color(l, to, 4.0f).setLoopPingPong(1).setEase(LeanTweenType.easeOutBounce);
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            LeanTween.delayedCall(gameObject, 0.3f, delayedMethod).setRepeat(4).setOnCompleteOnRepeat(true).setOnCompleteParam("hi");
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            LeanTween.value(gameObject, updateColor, new Color(1.0f, 0.0f, 0.0f, 1.0f), Color.blue, 4.0f);//.setRepeat(2).setLoopPingPong().setEase(LeanTweenType.easeOutBounce);
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            LeanTween.delayedCall(0.05f, enterMiniGameStart).setOnCompleteParam(new object[] { "" + 5 });
        }

        if (Input.GetKeyDown(KeyCode.U))
        {
            #if !UNITY_FLASH
            LeanTween.value(gameObject, (Vector2 val) => {
                // Debug.Log("tweening vec2 val:"+val);
                transform.position = new Vector3(val.x, transform.position.y, transform.position.z);
            }, new Vector2(0f, 0f), new Vector2(5f, 100f), 1f).setEase(LeanTweenType.easeOutBounce);

            GameObject l = GameObject.Find("LCharacter");
            Debug.Log("x:" + l.transform.position.x + " y:" + l.transform.position.y);
            LeanTween.value(l, new Vector2(l.transform.position.x, l.transform.position.y), new Vector2(l.transform.position.x, l.transform.position.y + 5), 1f).setOnUpdate(
                (Vector2 val) => {
                Debug.Log("tweening vec2 val:" + val);
                l.transform.position = new Vector3(val.x, val.y, transform.position.z);
            }

                );
            #endif
        }
    }
Beispiel #4
0
        private void buildTween(LeanTweenItem item, float delayAdd, bool generateCode)
        {
            float delay = item.delay + delayAdd;
            bool  code  = generateCode;
            float d     = item.duration;

            // Debug.Log("item:"+item.action);
            if (item.action == TweenAction.ALPHA)
            {
                tween = code ? append("alpha", item.to.x, d) : LeanTween.alpha(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ALPHA_VERTEX)
            {
                tween = code ? append("alphaVertex", item.to.x, d) : LeanTween.alphaVertex(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE)
            {
                tween = code ? append("move", item.to, d) : LeanTween.move(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL)
            {
                tween = code ? append("moveLocal", item.to, d) : LeanTween.moveLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_X)
            {
                tween = code ? append("moveLocalX", item.to.x, d) : LeanTween.moveLocalX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Y)
            {
                tween = code ? append("moveLocalY", item.to.x, d) : LeanTween.moveLocalY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Z)
            {
                tween = code ? append("moveLocalZ", item.to.x, d) : LeanTween.moveLocalZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_X)
            {
                tween = code ? append("moveX", item.to.x, d) : LeanTween.moveX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Y)
            {
                tween = code ? append("moveY", item.to.x, d) : LeanTween.moveY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Z)
            {
                tween = code ? append("moveZ", item.to.x, d) : LeanTween.moveZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_CURVED)
            {
                tween = code ? append("move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.move(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_CURVED_LOCAL)
            {
                tween = code ? append("moveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.moveLocal(gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_SPLINE)
            {
                tween = code ? append("moveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.moveSpline(gameObject, item.splinePath.splineVector(), d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.ROTATE)
            {
                tween = code ? append("rotate", item.to, d) : LeanTween.rotate(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_AROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_AROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_LOCAL)
            {
                tween = code ? append("rotateLocal", item.to, d) : LeanTween.rotateLocal(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_X)
            {
                tween = code ? append("rotateX", item.to.x, d) : LeanTween.rotateX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Y)
            {
                tween = code ? append("rotateY", item.to.x, d) : LeanTween.rotateY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Z)
            {
                tween = code ? append("rotateZ", item.to.x, d) : LeanTween.rotateZ(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE)
            {
                tween = code ? append("scale", item.to, d) : LeanTween.scale(gameObject, item.to, d);
            }
            else if (item.action == TweenAction.SCALE_X)
            {
                tween = code ? append("scaleX", item.to.x, d) : LeanTween.scaleX(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Y)
            {
                tween = code ? append("scaleY", item.to.x, d) : LeanTween.scaleY(gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Z)
            {
                tween = code ? append("scaleZ", item.to.x, d) : LeanTween.scaleZ(gameObject, item.to.x, d);
            }
                        #if !UNITY_4_3 && !UNITY_4_5
            else if (item.action == TweenAction.CANVAS_MOVE)
            {
                tween = code ? appendRect("move", item.to, d) : LeanTween.move(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_SCALE)
            {
                tween = code ? appendRect("scale", item.to, d) : LeanTween.scale(GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(rectTransform, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ALPHA)
            {
                tween = code ? appendRect("alpha", item.to.x, d) : LeanTween.alpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.CANVAS_COLOR)
            {
                tween = code ? appendRect("color", item.colorTo, d) : LeanTween.color(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.TEXT_ALPHA)
            {
                tween = code ? appendRect("textAlpha", item.to.x, d) : LeanTween.textAlpha(GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.TEXT_COLOR)
            {
                tween = code ? appendRect("textColor", item.colorTo, d) : LeanTween.textColor(GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.CANVAS_PLAYSPRITE)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.play(rectTransform, sprites).setFrameRate(" + item.frameRate + "f)");
                }
                else
                {
                    tween = LeanTween.play(GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate);
                }
            }
                        #endif
            else if (item.action == TweenAction.COLOR)
            {
                tween = code ? append("color", item.colorTo, d) : LeanTween.color(gameObject, item.colorTo, d);
            }
            else if (item.action == TweenAction.DELAYED_SOUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.delayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)");
                }
                else
                {
                    tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration);
                }
            }
            else
            {
                tween = null;
                Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item);
                return;
            }


            // Append Extras
            if (generateCode)
            {
                if (delay > 0f)
                {
                    codeBuild.Append(".setDelay(" + delay + "f)");
                }
            }
            else
            {
                tween = tween.setDelay(delay);
            }
            if (item.ease == LeanTweenType.animationCurve)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setEase(");
                    append(item.animationCurve);
                    codeBuild.Append(")");
                }
                else
                {
                    tween.setEase(item.animationCurve);
                }
            }
            else
            {
                if (generateCode)
                {
                    if (item.ease != LeanTweenType.linear)
                    {
                        codeBuild.Append(".setEase(LeanTweenType." + item.ease + ")");
                    }
                }
                else
                {
                    tween.setEase(item.ease);
                }
            }
            // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease);
            if (item.between == LeanTweenBetween.FromTo)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setFrom(" + item.from + ")");
                }
                else
                {
                    tween.setFrom(item.from);
                }
            }
            if (item.doesLoop)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setRepeat(" + item.loopCount + ")");
                }
                else
                {
                    tween.setRepeat(item.loopCount);
                }

                if (item.loopType == LeanTweenType.pingPong)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".setLoopPingPong()");
                    }
                    else
                    {
                        tween.setLoopPingPong();
                    }
                }
            }
            if (generateCode)
            {
                codeBuild.Append(";\n");
            }
        }
Beispiel #5
0
 public IEnumerator HideAni()
 {
     LeanTween.moveLocalX(m_UIPanelObj, 500f, 0.3f);
     yield return(new WaitForSeconds(0.3f));
 }
Beispiel #6
0
 void Side2Side(float distance)
 {
     LeanTween.moveLocalX(this.gameObject, distance, speed).setEaseLinear().setLoopPingPong();
 }
Beispiel #7
0
    private IEnumerator HorizontalFly()
    {
        while (true)
        {
            LeanTween.moveLocalX(gameObject, -BOSS_HORIZONTAL_MAX_X, BOSS_HORIZONTAL_FLY_TIME).setOnComplete(() => LeanTween.moveLocalX(
                                                                                                                 gameObject,
                                                                                                                 BOSS_HORIZONTAL_MAX_X,
                                                                                                                 BOSS_HORIZONTAL_FLY_TIME * 2));

            yield return(new WaitForSeconds(BOSS_HORIZONTAL_FLY_PERIOD));
        }
    }
 public void MoveSideways(float xValue)
 {
     LeanTween.moveLocalX(gameObject, transform.localPosition.x + xValue, TalkieSelection.MOVE_COOLDOWN - 0.1f)
     .setEaseOutCirc();
 }
Beispiel #9
0
 public void SettingPanelAnimation(GameObject gameObject, float to)
 {
     LeanTween.moveLocalX(gameObject, to, 0.25f).setEase(LeanTweenType.easeInOutExpo).setOnComplete(UIManager.instance.mainMenuUI.SettingAnimationCallback);
 }
Beispiel #10
0
 //LeanTween.moveLocal
 public static LTDescr LeanMoveLocalX(this GameObject gameObject, float to, float time)
 {
     return(LeanTween.moveLocalX(gameObject, to, time));
 }
Beispiel #11
0
 public static LTDescr LeanMoveLocalX(this Transform transform, float to, float time)
 {
     return(LeanTween.moveLocalX(transform.gameObject, to, time));
 }
Beispiel #12
0
    IEnumerator CO_TestLTCompleteBy(bool byTarget, bool tweenFloatValue)
    {
        Debug.Log(string.Format("{0} :: Create {1} tweens on {2}", Time.realtimeSinceStartup, totTweens, (tweenFloatValue ? "float" : "transform")));
        for (int i = 0; i < totTweens; ++i)
        {
            LTDescr lt = tweenFloatValue ? LeanTween.value(floatValue, 2.0f, 10.0f) : LeanTween.moveLocalX(go, 2.0f, 10.0f);

            if (!byTarget)
            {
                lt.setId((uint)i, 0);
            }
        }
        yield return(new WaitForSeconds(2f));

        Debug.Log(string.Format("{0} :: Complete {1} tweens by {2}", Time.realtimeSinceStartup, totTweens, (byTarget ? "target" : "id")));

        float time = Time.realtimeSinceStartup;

        LeanTween.cancelAll();

        float elapsed = Time.realtimeSinceStartup - time;

        Debug.Log(string.Format("{0} :: Completed {1} tweens in {2} [ms]", Time.realtimeSinceStartup, totTweens, elapsed * 1000.0f));
    }
Beispiel #13
0
 void Awake()
 {
     LeanTween.moveLocalX(gameObject, gameObject.transform.position.x - forceDir, secondsOfAnimation).setLoopPingPong();
 }
Beispiel #14
0
 public static LTDescr LTMoveLocalX(this Transform self, float to, float time)
 {
     return(LeanTween.moveLocalX(self.gameObject, to, time));
 }
 public void GoBackToMainMenu()
 {
     uiManager.DisplayGameOverScreen(false);
     LeanTween.moveLocalX(transitionSprite, 0f, _fadeTime * Time.timeScale);
     StartCoroutine(LoadMainMenu());
 }
Beispiel #16
0
 public void ExitPanleAnimation(GameObject gameObject, float to)
 {
     LeanTween.moveLocalX(gameObject, to, 0.25f).setEase(LeanTweenType.easeInOutExpo);
 }
 void Appoach()
 {
     gameObject.transform.position.Set(-6f, gameObject.transform.position.y, gameObject.transform.position.z);
     LeanTween.moveLocalX(gameObject, 1.629f, 3);
 }
Beispiel #18
0
 public LTDescr Show()
 {
     LeanTween.moveLocalX(velocityHandle, origVelocityHandleX, 1f).setEase(LeanTweenType.easeOutSine);
     return(LeanTween.moveLocalX(timerHandle, origTimerHandleX, 1f).setEase(LeanTweenType.easeOutSine));
 }
 public void Enter()
 {
     LeanTween.moveLocalX(target, 0f, 0.7f).setEase(LeanTweenType.easeOutBack).setOnComplete(WaitThenUp);
 }
Beispiel #20
0
 public LTDescr Hide()
 {
     LeanTween.moveLocalX(velocityHandle, offscreenVelocityHandleX, 1f).setEase(LeanTweenType.easeInSine);
     return(LeanTween.moveLocalX(timerHandle, offscreenTimerHandleX, 1f).setEase(LeanTweenType.easeInSine));
 }
Beispiel #21
0
    private void Update()
    {
        if (isAttacking && Time.time > nextAttack)
        {
            attackCount++;

            if (transform.parent.localPosition != originalHand)
            {
                transform.parent.localPosition = originalHand;
            }

            if (attackCount > 7)
            {
                attackCount = 0;
            }

            bool isBigAttack     = attackCount == 7;
            bool isFastAttack    = attackCount == 4 || attackCount == 5 || attackCount == 6;
            bool isBiggestAttack = attackCount == 0;

            Debug.Log(attackCount);

            if (isBigAttack)
            {
                isBigAttack = true;
                nextAttack  = Time.time + weaponStat.attackCountDown * DELAY_TIME_BIG_RATE;
            }
            else if (isFastAttack)
            {
                nextAttack = Time.time + weaponStat.attackCountDown * DELAY_TIME_FAST_RATE;
            }
            else if (isBiggestAttack)
            {
                nextAttack = Time.time + weaponStat.attackCountDown * DELAY_TIME_BIGGEST_RATE;
            }
            else
            {
                nextAttack = Time.time + weaponStat.attackCountDown;
            }

            if (isBigAttack)
            {
                attackPos = originalHand + new Vector3(ATTACK_RANGE_CHANGE_BIG, 0);
                transform.parent.localPosition = attackPos;

                float delay = weaponStat.attackCountDown * (DELAY_TIME_BIG_RATE - 1f);

                LeanTween.delayedCall(delay, () => {
                    LeanTween.moveLocalX(transform.parent.gameObject, originalHand.x, RETURN_TIME);
                });
            }
            else if (isBiggestAttack)
            {
                attackPos = originalHand + new Vector3(ATTACK_RANGE_CHANGE_BIGGEST, 0);
                transform.parent.localPosition = attackPos;

                float delay = weaponStat.attackCountDown * (DELAY_TIME_BIGGEST_RATE - 1f);

                LeanTween.delayedCall(delay, () => {
                    LeanTween.moveLocalX(transform.parent.gameObject, originalHand.x, RETURN_TIME);
                });
            }
            else
            {
                attackPos = originalHand + new Vector3(ATTACK_RANGE_CHANGE, 0);
                transform.parent.localPosition = attackPos;
                LeanTween.moveLocalX(transform.parent.gameObject, originalHand.x, RETURN_TIME);
            }
        }
    }
Beispiel #22
0
    void checkOverlapWithItem()
    {
        RaycastHit2D[] hit = Physics2D.RaycastAll(thisCollider.bounds.center, Vector2.zero, Mathf.Infinity, 1 << LayerMask.NameToLayer("Environment")).OrderBy(h => h.collider.GetComponent <Renderer>().sortingOrder).ToArray();

        if (hit.Length > 0)
        {
            if (hit [0].transform.name == "ropeMiddle" || hit [0].transform.name == "ropeTop" || hit [0].transform.name == "ropeDown")
            {
                if (state == "normal")
                {
                    transform.parent = baseParent;
                    Vector2 posNew = transform.parent.InverseTransformPoint(hit [0].transform.position);
                    LeanTween.moveLocalX(gameObject, posNew.x, 0.125f);

                    float movementY = inputBroker.GetAxis("Vertical");

                    bool confirmRope = false;

                    if (movementY > 0f && hit [0].transform.name == "ropeDown")
                    {
                        LeanTween.moveLocalY(gameObject, transform.localPosition.y + 0.2f, 0.05f);
                        confirmRope = true;
                    }
                    else if (movementY < 0f && hit [0].transform.name == "ropeTop")
                    {
                        LeanTween.moveLocalY(gameObject, transform.localPosition.y - 0.2f, 0.05f);
                        confirmRope = true;
                    }
                    else if (hit [0].transform.name == "ropeMiddle")
                    {
                        confirmRope = true;
                    }

                    if (confirmRope)
                    {
                        state = "rope";
                        resetState();
                        if (lastPlatform != null)
                        {
                            lastColliders.Add(lastPlatform);
                            Physics2D.IgnoreCollision(lastPlatform, thisCollider);
                        }
                    }
                }
            }
            else if (hit [0].transform.name == "door")
            {
                LeanTween.scaleX(hit [0].transform.gameObject, 0.8f, 0.5f);
                GetComponent <characterClass> ().enabled = false;
                LeanTween.value(0, 1, 0.2f).setOnComplete(() => {
                    globalScript.changeScene(hit [0].transform.GetChild(0).name);
                });
            }
        }
        else if (hit.Length <= 0)
        {
            if (state == "rope")
            {
                state = "normal";
                resetState();
                if (lastPlatform != null)
                {
                    lastColliders.Remove(lastPlatform);
                    Physics2D.IgnoreCollision(lastPlatform, thisCollider, false);
                }
            }
        }
    }
Beispiel #23
0
 public void CloseMenu()
 {
     isOpen = false;
     LeanTween.moveLocalX(menuPanel, xClose, tweenTime);
     AudioManager.instance.PlaySFX("close_menu");
 }
Beispiel #24
0
        void Start()
        {
            //          Time.timeScale = 0.25f;

            LeanTest.timeout  = 46f;
            LeanTest.expected = 62;

            LeanTween.init(1300);

            // add a listener
            LeanTween.addListener(cube1, 0, eventGameObjectCalled);

            LeanTest.expect(LeanTween.isTweening() == false, "NOTHING TWEEENING AT BEGINNING");

            LeanTest.expect(LeanTween.isTweening(cube1) == false, "OBJECT NOT TWEEENING AT BEGINNING");

            LeanTween.scaleX(cube4, 2f, 0f).setOnComplete(() => {
                LeanTest.expect(cube4.transform.localScale.x == 2f, "TWEENED WITH ZERO TIME");
            });

            // dispatch event that is received
            LeanTween.dispatchEvent(0);
            LeanTest.expect(eventGameObjectWasCalled, "EVENT GAMEOBJECT RECEIVED");

            // do not remove listener
            LeanTest.expect(LeanTween.removeListener(cube2, 0, eventGameObjectCalled) == false, "EVENT GAMEOBJECT NOT REMOVED");
            // remove listener
            LeanTest.expect(LeanTween.removeListener(cube1, 0, eventGameObjectCalled), "EVENT GAMEOBJECT REMOVED");

            // add a listener
            LeanTween.addListener(1, eventGeneralCalled);

            // dispatch event that is received
            LeanTween.dispatchEvent(1);
            LeanTest.expect(eventGeneralWasCalled, "EVENT ALL RECEIVED");

            // remove listener
            LeanTest.expect(LeanTween.removeListener(1, eventGeneralCalled), "EVENT ALL REMOVED");

            lt1Id = LeanTween.move(cube1, new Vector3(3f, 2f, 0.5f), 1.1f).id;
            LeanTween.move(cube2, new Vector3(-3f, -2f, -0.5f), 1.1f);

            LeanTween.reset();

            // Queue up a bunch of tweens, cancel some of them but expect the remainder to finish
            GameObject[] cubes    = new GameObject[99];
            int[]        tweenIds = new int[cubes.Length];
            for (int i = 0; i < cubes.Length; i++)
            {
                GameObject c = cubeNamed("cancel" + i);
                tweenIds[i] = LeanTween.moveX(c, 100f, 1f).id;
                cubes[i]    = c;
            }
            int onCompleteCount = 0;

            LeanTween.delayedCall(cubes[0], 0.2f, () => {
                for (int i = 0; i < cubes.Length; i++)
                {
                    if (i % 3 == 0)
                    {
                        LeanTween.cancel(cubes[i]);
                    }
                    else if (i % 3 == 1)
                    {
                        LeanTween.cancel(tweenIds[i]);
                    }
                    else if (i % 3 == 2)
                    {
                        LTDescr descr = LeanTween.descr(tweenIds[i]);
                        //                      Debug.Log("descr:"+descr);
                        descr.setOnComplete(() => {
                            onCompleteCount++;
                            //                          Debug.Log("onCompleteCount:"+onCompleteCount);
                            if (onCompleteCount >= 33)
                            {
                                LeanTest.expect(true, "CANCELS DO NOT EFFECT FINISHING");
                            }
                        });
                    }
                }
            });

            Vector3[] splineArr = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f), new Vector3(30f, 0f, 0f) };
            LTSpline  cr        = new LTSpline(splineArr);

            cr.place(cube4.transform, 0.5f);
            LeanTest.expect((Vector3.Distance(cube4.transform.position, new Vector3(10f, 0f, 0f)) <= 0.7f), "SPLINE POSITIONING AT HALFWAY", "position is:" + cube4.transform.position + " but should be:(10f,0f,0f)");
            LeanTween.color(cube4, Color.green, 0.01f);

            //          Debug.Log("Point 2:"+cr.ratioAtPoint(splineArr[2]));

            // OnStart Speed Test for ignoreTimeScale vs normal timeScale

            GameObject cubeDest    = cubeNamed("cubeDest");
            Vector3    cubeDestEnd = new Vector3(100f, 20f, 0f);

            LeanTween.move(cubeDest, cubeDestEnd, 0.7f);

            GameObject cubeToTrans = cubeNamed("cubeToTrans");

            LeanTween.move(cubeToTrans, cubeDest.transform, 1.2f).setEase(LeanTweenType.easeOutQuad).setOnComplete(() => {
                LeanTest.expect(cubeToTrans.transform.position == cubeDestEnd, "MOVE TO TRANSFORM WORKS");
            });

            GameObject cubeDestroy = cubeNamed("cubeDestroy");

            LeanTween.moveX(cubeDestroy, 200f, 0.05f).setDelay(0.02f).setDestroyOnComplete(true);
            LeanTween.moveX(cubeDestroy, 200f, 0.1f).setDestroyOnComplete(true).setOnComplete(() => {
                LeanTest.expect(true, "TWO DESTROY ON COMPLETE'S SUCCEED");
            });

            GameObject cubeSpline = cubeNamed("cubeSpline");

            LeanTween.moveSpline(cubeSpline, new Vector3[] { new Vector3(0.5f, 0f, 0.5f), new Vector3(0.75f, 0f, 0.75f), new Vector3(1f, 0f, 1f), new Vector3(1f, 0f, 1f) }, 0.1f).setOnComplete(() => {
                LeanTest.expect(Vector3.Distance(new Vector3(1f, 0f, 1f), cubeSpline.transform.position) < 0.01f, "SPLINE WITH TWO POINTS SUCCEEDS");
            });

            // This test works when it is positioned last in the test queue (probably worth fixing when you have time)
            GameObject jumpCube = cubeNamed("jumpTime");

            jumpCube.transform.position    = new Vector3(100f, 0f, 0f);
            jumpCube.transform.localScale *= 100f;
            int jumpTimeId = LeanTween.moveX(jumpCube, 200f, 1f).id;

            LeanTween.delayedCall(gameObject, 0.2f, () => {
                LTDescr d     = LeanTween.descr(jumpTimeId);
                float beforeX = jumpCube.transform.position.x;
                d.setTime(0.5f);
                LeanTween.delayedCall(0.0f, () => { }).setOnStart(() => {
                    float diffAmt = 1f;// This variable is dependent on a good frame-rate because it evalutes at the next Update
                    beforeX      += Time.deltaTime * 100f * 2f;
                    LeanTest.expect(Mathf.Abs(jumpCube.transform.position.x - beforeX) < diffAmt, "CHANGING TIME DOESN'T JUMP AHEAD", "Difference:" + Mathf.Abs(jumpCube.transform.position.x - beforeX) + " beforeX:" + beforeX + " now:" + jumpCube.transform.position.x + " dt:" + Time.deltaTime);
                });
            });

            // Tween with time of zero is needs to be set to it's final value
            GameObject zeroCube = cubeNamed("zeroCube");

            LeanTween.moveX(zeroCube, 10f, 0f).setOnComplete(() => {
                LeanTest.expect(zeroCube.transform.position.x == 10f, "ZERO TIME FINSHES CORRECTLY", "final x:" + zeroCube.transform.position.x);
            });

            // Scale, and OnStart
            GameObject cubeScale = cubeNamed("cubeScale");

            LeanTween.scale(cubeScale, new Vector3(5f, 5f, 5f), 0.01f).setOnStart(() => {
                LeanTest.expect(true, "ON START WAS CALLED");
            }).setOnComplete(() => {
                LeanTest.expect(cubeScale.transform.localScale.z == 5f, "SCALE", "expected scale z:" + 5f + " returned:" + cubeScale.transform.localScale.z);
            });

            // Rotate
            GameObject cubeRotate = cubeNamed("cubeRotate");

            LeanTween.rotate(cubeRotate, new Vector3(0f, 180f, 0f), 0.02f).setOnComplete(() => {
                LeanTest.expect(cubeRotate.transform.eulerAngles.y == 180f, "ROTATE", "expected rotate y:" + 180f + " returned:" + cubeRotate.transform.eulerAngles.y);
            });

            // RotateAround
            GameObject cubeRotateA = cubeNamed("cubeRotateA");

            LeanTween.rotateAround(cubeRotateA, Vector3.forward, 90f, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeRotateA.transform.eulerAngles.z == 90f, "ROTATE AROUND", "expected rotate z:" + 90f + " returned:" + cubeRotateA.transform.eulerAngles.z);
            });

            // RotateAround 360
            GameObject cubeRotateB = cubeNamed("cubeRotateB");

            cubeRotateB.transform.position = new Vector3(200f, 10f, 8f);
            LeanTween.rotateAround(cubeRotateB, Vector3.forward, 360f, 0.3f).setPoint(new Vector3(5f, 3f, 2f)).setOnComplete(() => {
                LeanTest.expect(cubeRotateB.transform.position.ToString() == (new Vector3(200f, 10f, 8f)).ToString(), "ROTATE AROUND 360", "expected rotate pos:" + (new Vector3(200f, 10f, 8f)) + " returned:" + cubeRotateB.transform.position);
            });

            // Alpha, onUpdate with passing value, onComplete value
            LeanTween.alpha(cubeAlpha1, 0.5f, 0.1f).setOnUpdate((float val) => {
                LeanTest.expect(val != 0f, "ON UPDATE VAL");
            }).setOnCompleteParam("Hi!").setOnComplete((object completeObj) => {
                LeanTest.expect(((string)completeObj) == "Hi!", "ONCOMPLETE OBJECT");
                LeanTest.expect(cubeAlpha1.GetComponent <Renderer>().material.color.a == 0.5f, "ALPHA");
            });
            // Color
            float onStartTime = -1f;

            LeanTween.color(cubeAlpha2, Color.cyan, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.GetComponent <Renderer>().material.color == Color.cyan, "COLOR");
                LeanTest.expect(onStartTime >= 0f && onStartTime < Time.time, "ON START", "onStartTime:" + onStartTime + " time:" + Time.time);
            }).setOnStart(() => {
                onStartTime = Time.time;
            });
            // moveLocalY (make sure uses y values)
            Vector3 beforePos = cubeAlpha1.transform.position;

            LeanTween.moveY(cubeAlpha1, 3f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha1.transform.position.x == beforePos.x && cubeAlpha1.transform.position.z == beforePos.z, "MOVE Y");
            });

            Vector3 beforePos2 = cubeAlpha2.transform.localPosition;

            LeanTween.moveLocalZ(cubeAlpha2, 12f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.transform.localPosition.x == beforePos2.x && cubeAlpha2.transform.localPosition.y == beforePos2.y, "MOVE LOCAL Z", "ax:" + cubeAlpha2.transform.localPosition.x + " bx:" + beforePos.x + " ay:" + cubeAlpha2.transform.localPosition.y + " by:" + beforePos2.y);
            });

            AudioClip audioClip = LeanAudio.createAudio(new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(1f, 0f, -1f, 0f)), new AnimationCurve(new Keyframe(0f, 0.001f, 0f, 0f), new Keyframe(1f, 0.001f, 0f, 0f)), LeanAudio.options());

            LeanTween.delayedSound(gameObject, audioClip, new Vector3(0f, 0f, 0f), 0.1f).setDelay(0.2f).setOnComplete(() => {
                LeanTest.expect(Time.time > 0, "DELAYED SOUND");
            });

            // Easing Methods
            int totalEasingCheck        = 0;
            int totalEasingCheckSuccess = 0;

            for (int j = 0; j < 2; j++)
            {
                bool isCheckingFrom       = j == 1;
                int  totalTweenTypeLength = (int)LeanTweenType.easeShake;
                for (int i = (int)LeanTweenType.notUsed; i < totalTweenTypeLength; i++)
                {
                    LeanTweenType easeType = (LeanTweenType)i;
                    GameObject    cube     = cubeNamed("cube" + easeType);
                    LTDescr       descr    = LeanTween.moveLocalX(cube, 5, 0.1f).setOnComplete((object obj) => {
                        GameObject cubeIn = obj as GameObject;
                        totalEasingCheck++;
                        if (cubeIn.transform.position.x == 5f)
                        {
                            totalEasingCheckSuccess++;
                        }
                        if (totalEasingCheck == (2 * totalTweenTypeLength))
                        {
                            LeanTest.expect(totalEasingCheck == totalEasingCheckSuccess, "EASING TYPES");
                        }
                    }).setOnCompleteParam(cube);

                    if (isCheckingFrom)
                    {
                        descr.setFrom(-5f);
                    }
                }
            }

            // value2
            bool value2UpdateCalled = false;

            LeanTween.value(gameObject, new Vector2(0, 0), new Vector2(256, 96), 0.1f).setOnUpdate((Vector2 value) => {
                value2UpdateCalled = true;
            });
            LeanTween.delayedCall(0.2f, () => {
                LeanTest.expect(value2UpdateCalled, "VALUE2 UPDATE");
            });

            // check descr
            //          LTDescr descr2 = LeanTween.descr( descrId );
            //          LeanTest.expect(descr2 == null,"DESCRIPTION STARTS AS NULL");

            StartCoroutine(timeBasedTesting());
        }
 public void Enter()
 {
     slimeText.text = slimesCollected + "/" + totalSlimes;
     timeText2.text = (int)time + "." + (int)((time * 100f - ((int)time) * 100)) + "s";
     LeanTween.moveLocalX(congratsText, 0f, 0.7f).setEase(LeanTweenType.easeOutBack).setOnComplete(EnterTime);
 }
 public void StringRest()
 {
     LeanTween.moveLocalX(stringPullPoint, 0f, 0.05f);
     //stringPullout = stringRestPosition;
     //bowStringLinerenderer.SetPosition(1, stringPullout);
 }
 public void EnterSlime()
 {
     LeanTween.moveLocalX(slimesText, -0.3f, 0.3f).setEase(LeanTweenType.easeOutBack).setOnComplete(WaitThenUp);
 }
    /*public void drawBowString()
     * {
     *  //bowStringLinerenderer.SetPosition(0, bowStringPosition[0]);
     *  bowStringLinerenderer.SetPosition(1, stringPullout);
     *  //bowStringLinerenderer.SetPosition(2, bowStringPosition[1]);
     * }*/

    public void BowShake()
    {
        LeanTween.moveLocalX(gameObject, -0.4f, 0.05f).setLoopPingPong(1);
    }
    ///弹出并显示一条播报
    public void popRadio()
    {
        clearTween();
        if (radiolist.Count > 0)
        {
            LTDescr ltd;


            currentRadio = radiolist [0];
            radiolist.RemoveAt(0);
            currentRadioTime = 0;
            //temp
//			currentRadio.scale = 2f;

            //首阶段显现时间
            float timeApper = 0.2f / currentRadio.scale;
            //次阶段缓动动画时间
            float timeEnter = 0.1f;
            //第三阶段缓动动画时间
            float timeNext = 0.2f;
            //最后阶段缓动动画时间
            float timeFinish = 0.2f;

            Color outlineColor;
            //更新双方和文字
            if (currentRadio.player1 != null)
            {
                player1FaceImage.gameObject.SetActive(true);
                player1FrameImage.gameObject.SetActive(true);
                ResFactory.setHeadSprite(currentRadio.player1.headUrl, player1FaceImage, currentRadio.player1.uid);
                player1FrameImage.color = currentRadio.player1.getTeamColor(2);
//				lineImage.color = currentRadio.player1.getTeamColor (2);

                //头像偏移
                ltd           = LeanTween.moveLocalX(player1FrameImage.gameObject, player1LocalPosition.x + offsetTween, timeEnter);
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper * 0.5f;

                outlineColor = currentRadio.player1.getTeamColor(2);

                bgImage.transform.localPosition = bgImagePosition0;
                bgInnerImage.gameObject.SetActive(false);
                radioText.rectTransform.sizeDelta = radioTextSizeDelta0;
            }
            else
            {
                //没有主动玩家,一般性播报
                player1FaceImage.gameObject.SetActive(false);
                player1FrameImage.gameObject.SetActive(false);

                outlineColor = currentRadio.color;

                bgImage.transform.localPosition = bgImagePosition1;
                bgInnerImage.gameObject.SetActive(true);
                radioText.rectTransform.sizeDelta = radioTextSizeDelta1;
            }

            if (currentRadio.player2 != null)
            {
                player2FaceImage.gameObject.SetActive(true);
                player2FrameImage.gameObject.SetActive(true);
                ResFactory.setHeadSprite(currentRadio.player2.headUrl, player2FaceImage, currentRadio.player2.uid);
                player2FrameImage.color = currentRadio.player2.getTeamColor(2);

                ltd           = LeanTween.moveLocalX(player2FrameImage.gameObject, player2LocalPosition.x - offsetTween, timeEnter);
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper * 0.5f;

                //击杀红叉图片缩放,透明显现变化颜色
                float   scale = 3f;
                Vector3 v3    = new Vector3(scale, scale, scale);
                deadImage.transform.localScale = v3;
                ltd           = LeanTween.scale(deadImage.gameObject, deadLocalScale, timeFinish);
                ltd.tweenType = LeanTweenType.easeOutBack;
                ltd.delay     = timeApper + timeEnter + timeNext * 0.5f;

                deadImage.color = colorStart;
                ltd             = LeanTween.value(this.gameObject, (Color color) =>
                {
                    deadImage.color = color;
                },
                                                  colorStart,
                                                  Color.white,
                                                  timeFinish * 0.5f
                                                  );
                ltd.tweenType = LeanTweenType.easeOutSine;
                ltd.delay     = timeApper + timeEnter + timeNext * 0.5f;
            }
            else
            {
                player2FaceImage.gameObject.SetActive(false);
                player2FrameImage.gameObject.SetActive(false);
            }

            //文字和外发光
            radioTextOutline.effectColor = outlineColor;
            radioText.text = currentRadio.info;

            //音效
            if (currentRadio.player1 != null && currentRadio.player2 != null)
            {
                int player1Type = currentRadio.player1.teamType;
                int player2Type = currentRadio.player2.teamType;
                if (player1Type == 0)
                {
                    playVoice(currentRadio.voiceIDo);
                }
                else if (player2Type == 0)
                {
                    playVoice(currentRadio.voiceDoMe);
                }
                else if (player1Type == 1)
                {
                    playVoice(currentRadio.voiceAllyDo);
                }
                else if (player1Type == 2)
                {
                    playVoice(currentRadio.voiceEnermyDo);
                }
                else
                {
                    playVoice(currentRadio.voice);
                }
            }
            else
            {
                playVoice(currentRadio.voice);
            }

//			Vector3 position;
//			if (false && currentRadio.cardId != null) {
//				//有击杀卡片展示
//				cardImage.gameObject.SetActive (true);
//				cardImage.sprite = ViewUtils.LoadSprite(currentRadio.cardId);
//
//				position = new Vector3();
//				position.x = -radioText.preferredWidth * 0.5f - 22f;
//				cardImage.transform.localPosition = position;
//
//				position = new Vector3();
//				position.x = 22f;
//				radioText.transform.localPosition = position;
//			} else {
            //无击杀卡片展示
//				cardImage.gameObject.SetActive (false);
//
//				position = new Vector3();
//				radioText.transform.localPosition = position;
//			}


            GameObject lightningGo       = null;
            Animator   lightningAnimator = null;
            if (currentRadio.lightningScale > 0)
            {
                if (currentRadio.player1 == null || currentRadio.player1.teamType <= 1)
                {
                    //蓝色闪电
                    lightningGo       = lightningGo1;
                    lightningAnimator = lightningAnimator1;
                }
                else
                {
                    //红色闪电
                    lightningGo       = lightningGo2;
                    lightningAnimator = lightningAnimator2;
                }
            }

            //击杀文字缩放
            if (currentRadio.scale > 1f)
            {
                float   scale1 = (currentRadio.scale - 1f) * 5 + 1;
                float   scale2 = (currentRadio.scale - 1f) * 2 + 1;
                Vector3 v3_1   = new Vector3(scale1, scale1, scale1);
                Vector3 v3_2   = new Vector3(scale2, scale2, scale2);

                radioText.transform.localScale = v3_1;

                ltd            = LeanTween.scale(radioText.gameObject, v3_2, timeEnter);
                ltd.delay      = timeApper * 0.5f;
                ltd.onComplete = () => {
                    LTDescr ltd_ = LeanTween.scale(radioText.gameObject, textLocalScale, timeNext);
                    ltd_.tweenType = LeanTweenType.easeOutBack;

                    if (lightningGo != null)
                    {
                        float   scale = currentRadio.lightningScale;
                        Vector3 v3    = new Vector3(scale, scale, scale);
                        LeanTween.delayedCall(timeEnter * 0.5f, () => {
                            //闪电
                            lightningAnimator.Play("play");
                        });
                    }
                };
                //透明显现
                radioText.color = colorStart;
                ltd             = LeanTween.value(this.gameObject, (Color color) =>
                {
                    radioText.color = color;
                },
                                                  colorStart,
                                                  Color.white,//player1Color
                                                  timeEnter
                                                  );
                ltd.delay = timeApper * 0.5f;
            }

            //整体透明显现
            ltd = LeanTween.value(this.gameObject, (float value) =>
            {
                canvasGroup.alpha = value;
            },
                                  canvasGroup.alpha,
                                  1,
                                  timeApper
                                  );
            ltd.onComplete = () => {
                isSwitch = false;
            };
        }
    }
Beispiel #30
0
 private void MoveBar(float targetPosX)
 {
     LeanTween.moveLocalX(arrow.gameObject, targetPosX, 0.5f);
 }