moveLocal() public static method

public static moveLocal ( GameObject gameObject, LTBezierPath, to, float time ) : LTDescr,
gameObject GameObject
to LTBezierPath,
time float
return LTDescr,
Beispiel #1
0
        public IEnumerator Lob(Lob lob, Transform origin, Transform target)
        {
            var obj       = lob.Projectile;
            var targetPos = obj.transform.parent.InverseTransformPoint(target.position);
            var lt        = LeanTween.moveLocal(obj, targetPos, lob.Style.Duration);

            // Obsolete. Use the new enum.
            if (lob.Style.Elastic)
            {
                lt.setEaseInBack()
                .setScale(lob.Style.Elasticity);
            }

            switch (lob.Style.Easing)
            {
            case LobEasing.In:
                lt.setEaseInCubic();
                break;

            case LobEasing.Out:
                lt.setEaseOutCubic();
                break;

            case LobEasing.InOut:
                lt.setEaseInOutCubic();
                break;

            case LobEasing.ElasticIn:
                lt.setEaseInBack();
                break;

            case LobEasing.ElasticOut:
                lt.setEaseOutBack();
                break;

            case LobEasing.ElasticInOut:
                lt.setEaseInOutBack();
                break;
            }

            yield return(new WaitForSeconds(lob.Style.Duration));
        }
    // Use this for initialization
    void Start()
    {
        // Recursion - Set a objects value and have it recursively effect it's children
        LeanTween.alpha(avatarRecursive, 0f, 1f).setRecursive(true).setLoopPingPong();
        LeanTween.alpha(avatar2dRecursive, 0f, 1f).setRecursive(true).setLoopPingPong();
        LeanTween.alpha(wingPersonPanel, 0f, 1f).setRecursive(true).setLoopPingPong();

        // Destroy on Complete -

        // Chaining tweens together

        // setOnCompleteOnRepeat


        // Move to path of transforms that are moving themselves
        LeanTween.value(avatarMove, 0f, (float)movePts.Length - 1, 5f).setOnUpdate((float val) => {
            int first  = (int)Mathf.Floor(val);
            int next   = first < movePts.Length - 1 ? first + 1 : first;
            float diff = val - (float)first;
            // Debug.Log("val:"+val+" first:"+first+" next:"+next);
            Vector3 diffPos = (movePts[next].position - movePts[first].position);
            avatarMove.transform.position = movePts[first].position + diffPos * diff;
        }).setEase(LeanTweenType.easeInOutExpo).setLoopPingPong();

        // move the pts
        for (int i = 0; i < movePts.Length; i++)
        {
            LeanTween.moveY(movePts[i].gameObject, movePts[i].position.y + 1.5f, 1f).setDelay(((float)i) * 0.2f).setLoopPingPong();
        }


        // move objects at a constant speed
        for (int i = 0; i < avatarSpeed.Length; i++)
        {
            LeanTween.moveLocalZ(avatarSpeed[i], (i + 1) * 5f, 1f).setSpeed(6f).setEase(LeanTweenType.easeInOutExpo).setLoopPingPong();          // any time you set the speed it overrides the time value
        }
        // move around a circle at a constant speed
        for (int i = 0; i < avatarSpeed2.Length; i++)
        {
            LeanTween.moveLocal(avatarSpeed2[i], i == 0 ? circleSm : circleLrg, 1f).setSpeed(20f).setRepeat(-1);
        }
    }
Beispiel #3
0
    public virtual void setActiveWindow(bool value)
    {
        isActive = value;

        onBeginTransition(value);

        switch (windowType)
        {
        case WindowType.Fade:
        {
            float alpha = (value) ? fade : 0f;
            LeanTween.alpha(gameObject.GetComponent <RectTransform>(), alpha, time).setOnComplete(() => {
                    onFinishTransition(value);
                });
            break;
        }

        case WindowType.Scale:
        {
            Vector3 scale = (value) ? Vector3.one : Vector3.zero;
            LeanTween.scale(gameObject.GetComponent <RectTransform>(), scale, time).setOnComplete(() => {
                    onFinishTransition(value);
                });
            break;
        }

        case WindowType.Move:
        {
            Vector3 pos = (value) ? posFinal.localPosition : posInit.localPosition;
            LeanTween.moveLocal(gameObject, pos, time).setOnComplete(() => {
                    onFinishTransition(value);
                });
            break;
        }

        case WindowType.None:
        {
            onFinishTransition(value);
            break;
        }
        }
    }
Beispiel #4
0
    public void ShowTransition()
    {
        StartCoroutine(IE_NotifyShown());

        LTDescr showDescription;

        switch (_transitionType)
        {
        case TransitionType.Fade:
        {
            if (_canvasGroup == null)
            {
                return;
            }

            LeanTween.alphaCanvas(_canvasGroup, _from.x, 0);
            showDescription = LeanTween.alphaCanvas(_canvasGroup, _to.x, _showTransitionTime);
            break;
        }

        case TransitionType.Move:
        {
            transform.localPosition = _from;
            showDescription         = LeanTween.moveLocal(gameObject, _to, _showTransitionTime);
            break;
        }

        case TransitionType.Zoom:
        {
            transform.localScale = _from;
            showDescription      = LeanTween.scale(gameObject, _to, _showTransitionTime);
            break;
        }

        default:
        {
            return;
        }
        }

        showDescription.setEase(_showLeanTweenType);
    }
Beispiel #5
0
    public void Fade()
    {
        if (check == 0)
        {
            LeanTween.moveLocal(gameObject, positionToMove, animTime);
        }
        else
        {
            LeanTween.moveLocal(gameObject, startingPosition, animTime);
        }

        if (check == 0)
        {
            check = 1;
        }
        else
        {
            check = 0;
        }
    }
Beispiel #6
0
 private void EnactProgressionChange()
 {
     print($"Progression level={progression}");
     foreach (ProgressionInfo progressionPosition in _progressionInfo)
     {
         if (progressionPosition.ProgressionLevel == progression)
         {
             if (progressionPosition.Obj != null)
             {
                 LeanTween.moveLocal(progressionPosition.Obj, progressionPosition.Position, 1)
                 .setEase(LeanTweenType.easeInOutQuad).setOnComplete(
                     () => { progressionPosition.Code?.Invoke(); });
             }
             else
             {
                 progressionPosition.Code.Invoke();
             }
         }
     }
 }
    IEnumerator HideCo()
    {
        if (isUsed)
        {
            yield break;
        }

        isUsed = true;

        GetComponent <InteractiveObject>().isAbleToInteract = false;
        isHoverd = false;
        LeanTween.cancel(gameObject);
        LeanTween.moveLocal(gameObject, transform.forward * 0.05f, 0.7f).setEase(LeanTweenType.easeInOutCubic);
        var newLocalRotation = new Vector3(initLocalRotation.eulerAngles.x + 180f, transform.localRotation.eulerAngles.y, transform.localRotation.eulerAngles.z);

        LeanTween.rotateLocal(gameObject, newLocalRotation, 1f).setEase(LeanTweenType.easeInOutCubic);
        yield return(new WaitForSeconds(1f));

        LeanTween.moveLocal(gameObject, initLocalPosition, 1f).setEase(LeanTweenType.easeInOutCubic);
    }
Beispiel #8
0
    public void SetLocation(Vector3 pos, float time, LeanTweenType leanTweenType = LeanTweenType.notUsed, Action OnMoveComplete = null)
    {
        if (MoveLTDescr != null)
        {
            CancelMovementTween();
        }
        MoveLTDescr = LeanTween.moveLocal(this.gameObject, pos, time).setEase(leanTweenType).setOnUpdate(delegate(float value) {
            currentLocalPosition = rect.localPosition;
        }).setOnComplete(delegate() {
            currentLocalPosition = pos;

            if (OnMoveComplete != null)
            {
                OnMoveComplete();
            }


            MoveLTDescr = null;
        });
    }
Beispiel #9
0
 public void toggleIngameUi(bool state)
 {
     if (state == true)
     {
         if (LeanTween.isTweening(textTweenID))
         {
             LeanTween.cancel(textTweenID);
         }
         activation = state;
         LeanTween.moveLocal(Bar, finPos, appDelay);
         LeanTween.alphaText(beginText.GetComponent <RectTransform>(), 0, appDelay);
         LeanTween.moveLocal(UpgradeMenu, downFinPos, appDelay);
         LeanTween.moveLocal(UpperUi, iniPos, appDelay);
     }
     else
     {
         activation = state;
         LeanTween.moveLocal(Bar.gameObject, iniPos, 0.2f);
     }
 }
Beispiel #10
0
    Vector3[,] TempPathList;    //临时用于保存RectTranform的数据
    //显示路点路线变化
    void ShowMovePathLine()
    {
        TempPathList = new Vector3[movePathLine.Count, 2];
        for (int i = 0; i < movePathLine.Count; i++)
        {
            RectTransform lt = (RectTransform)movePathLine[i];

            //保存路点的数据
            TempPathList[i, 0] = lt.localPosition;
            TempPathList[i, 1] = lt.localRotation.eulerAngles;

            LeanTween.alpha(lt, 1, 0.4f);
            if (i < movePathLine.Count - 1)
            {
                RectTransform lt2 = (RectTransform)movePathLine[i + 1];
                LeanTween.moveLocal(lt.gameObject, lt2.localPosition, 0.4f).setLoopClamp();
                LeanTween.rotateLocal(lt.gameObject, lt2.localRotation.eulerAngles, 0.4f).setLoopClamp();
            }
        }
    }
 /// <summary>
 /// This will replace the Update function. Needs to have LeanTween set up correctly.
 /// </summary>
 /// <param name="move"></param>
 void HandleMoveNeedle(bool move)
 {
     if (move)
     {
         if (Vector3.Distance(needle.localPosition, needleEndPos.localPosition) > minDistanceToDestination)
         {
             LeanTween.pause(needle.gameObject);
             LeanTween.move(needle.gameObject, needleEndPos, finishedTime).setEase(LeanTweenType.linear);
         }
         else
         {
             moveNeedle = false; //Already finished the track
         }
     }
     else   //move is false so reset the needle back to the start
     {
         LeanTween.pause(needle.gameObject);
         LeanTween.moveLocal(needle.gameObject, needleStartPos, 0.5f).setEase(LeanTweenType.linear);
     }
 }
Beispiel #12
0
    public override IEnumerator Start()
    {
        LeanTween.moveLocal(BattleSystem.enemyGO, new Vector3(-20, 0, BattleSystem.enemyGO.transform.position.z), 2f);
        yield return(new WaitForSeconds(0.5f));

        BattleSystem.Destroy(BattleSystem.enemyGO);
        GameEvents.current.StopText();
        yield return(new WaitForSeconds(0.15f));

        GameEvents.current.FinishingUp();

        BattleSystem.AddDialogue("Darn, it ran.", "Well it doesn't matter. Good work Puppet, you don't seem entirely useless", "Thanks for playing~", "The game should close on it's own.", "Lmao it's still on", "Any second now",
                                 "Hitler did nothing wrong"
                                 , "What"
                                 , "A man can have a view"
                                 , "Don't judge me"
                                 , "You probably think this is a bit much",
                                 "But whatever it's my game not yours <3"
                                 , "Anyways why are you sill here.",
                                 "You must be really trying for this text",
                                 "Maybe hoping to find a secret message.",
                                 "Well you're not getting one",
                                 "Or are you?",
                                 "Maybe if you check the first letters of every sentence in this screen you can find out <3",
                                 "                                                                                         "
                                 ,
                                 "                                                                                         "
                                 ,
                                 "                                                                                         "
                                 ,
                                 "                                                                                         ",
                                 "Damn did you actually do that?",
                                 "Wow you're stupid you think I could be asked with that?",
                                 "Listen, I ain't that much of a loser to take my time to type a long ass puzzle for you",
                                 "I have much better uses of my time :)",
                                 "If you came this far. I'd just like to say thank you!");

        yield return(new WaitForSeconds(15f));

        Application.Quit();
    }
Beispiel #13
0
        private void SelectRole(RoleInfo roleInfo)
        {
            _selectedRoleInfo = roleInfo;
            if (_selectedRoleInfo != null)
            {
                ShowFormationPositionIndicators();
                if (PvpFormationProxy.instance.IsHeroInFormation(roleInfo.instanceID))
                {
                    FormationPosition formationPosition           = PvpFormationProxy.instance.GetHeroCurrentFormationPosition(roleInfo.instanceID);
                    Vector3           formationBaseButtonPosition = formationBaseButtons[(int)formationPosition - 1].transform.position;
                    removeRoleButton.transform.position = new Vector3(formationBaseButtonPosition.x, formationBaseButtonPosition.y, removeRoleButton.transform.position.z);
                    removeRoleButton.gameObject.SetActive(_selectedRoleInfo.instanceID != GameProxy.instance.PlayerInfo.instanceID);

                    Vector3 indicatorLocalPosition = selectedFormationPositionIndicatorImage.transform.parent.InverseTransformPoint(formationBaseButtons[(int)formationPosition - 1].transform.position);
                    indicatorLocalPosition = new Vector3(indicatorLocalPosition.x, indicatorLocalPosition.y + 230, -800);
                    selectedFormationPositionIndicatorImage.transform.localPosition = indicatorLocalPosition;
                    selectedFormationPositionIndicatorImage.gameObject.SetActive(true);
                    Vector3[] path = new Vector3[4];
                    path[0] = indicatorLocalPosition + new Vector3(0, 0, 0);
                    path[1] = indicatorLocalPosition + new Vector3(0, 30, 0);
                    path[2] = indicatorLocalPosition + new Vector3(0, 0, 0);
                    path[3] = indicatorLocalPosition + new Vector3(0, 0, 0);

                    LTDescr ltDescr = LeanTween.moveLocal(selectedFormationPositionIndicatorImage.gameObject, path, 0.6f);
                    ltDescr.setRepeat(-1);
                }
                else
                {
                    removeRoleButton.gameObject.SetActive(false);
                    selectedFormationPositionIndicatorImage.gameObject.SetActive(false);
                }
            }
            else
            {
                HideAllFormationPositionIndicators();
                removeRoleButton.gameObject.SetActive(false);
                selectedFormationPositionIndicatorImage.gameObject.SetActive(false);
                _selectedCommonHeroIcon = null;
            }
            scrollContent.RefreshAllContentItems();
        }
Beispiel #14
0
    public void TriggerFirstStage()
    {
        PNGOs = new GameObject[PNLayerNum];
        bool stageOneCompleted = false;

        GameObject targetTr = new GameObject("TargetTransform");

        for (int i = 0; i < PNLayerNum; i++)
        {
            targetTr.transform.position = new Vector3(BaseFilmGO.transform.position.x, BaseFilmGO.transform.position.y + ((i + 1) * posY), BaseFilmGO.transform.position.z);

            targetTr.transform.localScale = new Vector3(BaseFilmGO.transform.localScale.x, BaseFilmGO.transform.localScale.y, BaseFilmGO.transform.localScale.z - (i + 1) * scaleZ);

            if (i % 2 == 0f)
            {
                PNGOs[i] = (GameObject)Instantiate(PFilmTemplate, StartPos.position, Quaternion.identity);
                PNGOs[i].transform.localScale = BaseFilmGO.transform.localScale; //targetTr.transform.localScale;

                LeanTween.moveLocal(PNGOs[i], targetTr.transform.localPosition, 2f).setDelay(i).setOnComplete(() =>
                {
                    if (i == PNLayerNum - 1)
                    {
                        stageOneCompleted = true;
                    }
                });
            }
            else
            {
                PNGOs[i] = (GameObject)Instantiate(NFilmTemplate, StartPos.position, Quaternion.identity);
                PNGOs[i].transform.localScale = BaseFilmGO.transform.localScale;

                LeanTween.moveLocal(PNGOs[i], targetTr.transform.localPosition, 2f).setDelay(i).setOnComplete(() =>
                {
                    if (i == PNLayerNum - 1)
                    {
                        stageOneCompleted = true;
                    }
                });
            }
        }
    }
Beispiel #15
0
    private void Update()
    {
        // Raise shield
        if (Input.GetButtonDown(Constants.INPUT_SHIELD))
        {
            animator.SetBool("shieldUp", true);

            LeanTween.cancelAll(shield);
            LeanTween.moveLocal(shield, shieldUpPosition.localPosition, liftDuration).setEase(tweenType);
            LeanTween.scale(shield, shieldUpPosition.localScale, liftDuration).setOnComplete(() => { shieldUp = true; });
        }
        // Lower shield
        else if (Input.GetButtonUp(Constants.INPUT_SHIELD))
        {
            animator.SetBool("shieldUp", false);

            LeanTween.cancelAll(shield);
            LeanTween.moveLocal(shield, shieldDownPosition.localPosition, liftDuration).setEase(tweenType);
            LeanTween.scale(shield, shieldDownPosition.localScale, liftDuration).setOnComplete(() => { shieldUp = false; });
        }
    }
    /// <summary>
    /// Moves to a specific position in the movements index
    /// </summary>
    /// <param name="movementsIndex"></param>
    /// <returns></returns>
    private IEnumerator MoveToPosition(int movementsIndex)
    {
        LeanTween.moveLocal(
            gameObject,
            movements[movementsIndex].endPosition,
            movements[movementsIndex].duration).setEase(easingStyle).setDelay(movements[movementsIndex].delay);

        yield return(new WaitForSeconds(movements[movementsIndex].delay));

        if (!movements[movementsIndex].actionOnArrival)
        {
            movements[movementsIndex].action?.Invoke();
        }

        yield return(new WaitForSeconds(movements[movementsIndex].duration));

        if (movements[movementsIndex].actionOnArrival)
        {
            movements[movementsIndex].action?.Invoke();
        }
    }
Beispiel #17
0
	IEnumerator Wait2(float duration)
	{
		//This is a coroutine
		Debug.Log ("Start Wait() function. The time is: " + Time.time);
		Debug.Log ("Float duration = " + duration);
		yield return new WaitForSeconds (duration);
		LeanTween.moveLocal( g1, g1.transform.position + test, 3f).setDelay(1f);
		LeanTween.moveLocal( g2, g2.transform.position + test, 3f).setDelay(1f);
		LeanTween.moveLocal( g6, g6.transform.position + test, 3f).setDelay(1f);
		yield return new WaitForSeconds (duration-5f);   //Wait
		g6.transform.position = new Vector3 (-5000, 54,0);
		g1.transform.position = new Vector3 (-5000, -33,0);
		g2.transform.position = new Vector3 (-5000, -83,0);
		LeanTween.moveLocal( g1, g1.transform.position + test2, 1.5f);
		LeanTween.moveLocal( g2, g2.transform.position + test2, 1.5f);
		LeanTween.moveLocal( g6, g6.transform.position + test2, 1.5f);
		t.text = "3D Modeling";
		t1.text = "Althea Capuno";
		t2.text = "Steven Efthimiadis";
		Debug.Log ("End Wait() function and the time is: " + Time.time);
	}
Beispiel #18
0
    void OnSwipe(SwipeGesture gesture)
    {
        FingerGestures.SwipeDirection direction = gesture.Direction;
        if (direction == FingerGestures.SwipeDirection.Left ||
            direction == FingerGestures.SwipeDirection.LowerLeftDiagonal)
        {
            //If current step is the right sequence
            if (InhalerGameManager.Instance.IsCurrentStepCorrect(gameStepID))
            {
                if (!isGestureRecognized)
                {
                    isGestureRecognized = true;

                    //Lean tween cap
                    LeanTween.moveLocal(gameObject, targetPositionTween, 0.5f)
                    .setEase(LeanTweenType.easeOutQuad)
                    .setOnComplete(NextStep);
                }
            }
        }
    }
Beispiel #19
0
	IEnumerator Wait3(float duration)
	{
		//This is a coroutine
		Debug.Log ("Start Wait() function. The time is: " + Time.time);
		Debug.Log ("Float duration = " + duration);
		yield return new WaitForSeconds (duration);
		LeanTween.moveLocal( g1, g1.transform.position + test, 3f).setDelay(1f);
		LeanTween.moveLocal( g2, g2.transform.position + test, 3f).setDelay(1f);
		LeanTween.moveLocal( g6, g6.transform.position + test, 3f).setDelay(1f);
		yield return new WaitForSeconds (duration-15f);   //Wait
		g6.transform.position = new Vector3 (-5000, 54,0);
		g1.transform.position = new Vector3 (-5000, -33,0);
		g2.transform.position = new Vector3 (-5000, -83,0);
		LeanTween.moveLocal( g1, g1.transform.position + test2, 1.5f);
		LeanTween.moveLocal( g2, g2.transform.position + test2, 1.5f);
		LeanTween.moveLocal( g6, g6.transform.position + test2, 1.5f);
		t.text = "Music and Sound";
		t1.text = "David Harris";
		t2.text = "Robert Villella";
		Debug.Log ("End Wait() function and the time is: " + Time.time);
	}
        public void LocalMove(Axis axis, Vector3 vector, float time)
        {
            switch (axis)
            {
            case (Axis.X):
                LeanTween.moveLocalX(Target.gameObject, vector.x, time);
                break;

            case (Axis.Y):
                LeanTween.moveLocalY(Target.gameObject, vector.y, time);
                break;

            case (Axis.Z):
                LeanTween.moveLocalZ(Target.gameObject, vector.z, time);
                break;

            case (Axis.XY):
                LeanTween.moveLocal(Target.gameObject, vector, time);
                break;
            }
        }
    void MovingText(Text text, float Yoffset = 0f, bool isHide = true, float delaytime = .5f, Action action = null)
    {
        Vector3 Texttarget = new Vector3(text.transform.localPosition.x, text.transform.localPosition.y - Yoffset, text.transform.localPosition.z);
        Vector3 pos        = isHide? Texttarget : Textstartpos;

        LeanTween.moveLocal(text.gameObject, pos, .5f).setDelay(delaytime).setOnUpdate(delegate(float value)
        {//设置TEXT ALPHA从1-0;
         //      float alpha = -value;

            if (isHide)
            {
                float newalpha = UtilityFun.instance.Maping(value, 0, 1, 1, 0, false);
                ChangeTextAlpha(newalpha);
            }
            else
            {
                //     Debug.Log(value);
                ChangeTextAlpha(value);
            }
        }).setOnComplete(action);
    }
Beispiel #22
0
    void ShowMaterialIcon(CharBag.Goods goods, RectTransform rect)
    {
        //显示采集到的素材图标
        GameObject materiralicon = new GameObject();
        Image      sr            = materiralicon.AddComponent <Image>();

        sr.sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID);
        materiralicon.transform.position = rect.position;
        materiralicon.transform.SetParent(MateriralList.Find("ListBox"), false);
        materiralicon.transform.localScale = new Vector3(1, 1, 1);
        materiralicon.GetComponent <RectTransform>().sizeDelta = new Vector2(50, 50);

        //由路点落到list处
        RectTransform er = MateriralList.Find("ListBox").GetComponent <RectTransform>();

        LeanTween.moveLocal(materiralicon, new Vector3(er.localPosition.x, er.rect.height, 0), 1f);
        LeanTween.scale(materiralicon, new Vector3(0, 0, 0), 0.4f).setEase(LeanTweenType.easeInBack).setDestroyOnComplete(true).setOnComplete(() =>
        {
            StartCoroutine(ShowMateriralInList(goods));
        });
    }
Beispiel #23
0
    //매치 시작 시, 플레이어들의 이름을 보여줍니다.
    //음악재생, 카메라연출 추가함
    static public void DisplayPlayersName(string oppentName, string myName, PlayerSide mySide)
    {
        var UpperNickName = GameObject.Find("UpperNickName").GetComponent <Text>();
        var VS            = GameObject.Find("VS").GetComponent <Text>();
        var LowerNickName = GameObject.Find("LowerNickName").GetComponent <Text>();
        var bgCamera      = GameObject.Find("Background Camera").GetComponent <Camera>();

        if (mySide == PlayerSide.TOP)
        {
            UpperNickName.text = myName;
            LowerNickName.text = oppentName;
        }
        else
        {
            UpperNickName.text = oppentName;
            LowerNickName.text = myName;
        }

        //Upper Nick Name Move
        LeanTween.moveLocal(UpperNickName.gameObject, new Vector2(-120.0f, 45.0f), 1.5f).setEase(LeanTweenType.easeInCubic);
        LeanTween.moveLocal(UpperNickName.gameObject, new Vector2(1000.0f, 45.0f), 1.5f).setEase(LeanTweenType.easeInOutBack).setDelay(4.5f);

        //Lower Nick Name Move
        LeanTween.moveLocal(LowerNickName.gameObject, new Vector2(120.0f, -45.0f), 1.5f).setEase(LeanTweenType.easeInCubic);
        LeanTween.moveLocal(LowerNickName.gameObject, new Vector2(-1000.0f, -45.0f), 1.5f).setEase(LeanTweenType.easeInOutBack).setDelay(4.5f);

        //VS Move
        VS.gameObject.SetActive(true); //씬에서 디폴트로 꺼져있음
        LeanTween.moveLocal(VS.gameObject, new Vector2(0.0f, 1000.0f), 0.5f).setDelay(4.0f);

        //Camera Move
        System.Action <float, float> cameraMove = (float val, float ratio) => { bgCamera.orthographicSize = val * ratio; };
        LeanTween.value(bgCamera.gameObject, cameraMove, 0.3f, 9.0f, 0.6f).setEase(LeanTweenType.easeOutSine);

        //Play VS SFX
        SoundManager.GetInstance().Play(EFFECT_TYPE.VS, 1.4f);

        //Play music with delay
        SoundManager.GetInstance().Play(MUSIC_TYPE.GameScene, 4.25f);
    }
Beispiel #24
0
        public void WaveIn(int delay, int maxDelay, Action onComplete = null, float animationSpeed = 1f, float delayScale = 1f)
        {
            onComplete = onComplete ?? (() => {});
            var pos = transform.localPosition;

            // Set node far away and transparent
            transform.Translate(WaveInTravel * Vector3.forward);

            var colorizers = GetComponentsInChildren <Colorizer>();

            foreach (var colorizer in colorizers)
            {
                colorizer.Fade(0f);
            }

            // TODO: use smooth function over linear delay
            var moveDelay = WaveInMoveDelayStart * delayScale + (WaveInMoveDelayOffsetScale * delay) / maxDelay;

            // Start a nice animation effect
            LeanTween.moveLocal(gameObject, pos, WaveInTime * animationSpeed)
            .setOnStart(() => {
                _gameAudio.Play(GameClip.NodeEnter, WaveInAudioDelay);

                if (_checkmark == null)
                {
                    return;
                }
                _checkmark.SetActive(true);
                LeanTween.moveLocal(_checkmark, Vector3.back * 0.5f, WaveInTime * animationSpeed / 2f)
                .setEase(LeanTweenType.easeInOutSine);
            })
            .setDelay(moveDelay)
            .setEase(WaveInMoveEase)
            .setOnComplete(onComplete);

            foreach (var colorizer in colorizers)
            {
                colorizer.Previous(WaveInTime, moveDelay, WaveInColorEase);
            }
        }
Beispiel #25
0
        // Code that runs on entering the state.
        public override void OnEnter()
        {
            GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);

            Vector3 final = go.transform.localPosition + vector.Value;

            Fsm.Event(onStartEvent);

            LTDescr tween = LeanTween.moveLocal(go, final, time.Value);

            LeanTweenID.Value = tween.id;

            tween.setEase(easeType);
            tween.setDelay(delay.Value);

            if (noOfRepeat.Value > 0)
            {
                tween.setRepeat(noOfRepeat.Value);
            }

            switch (LoopType)
            {
            case LTLoop.clamp:
                tween.setLoopClamp();
                break;

            case LTLoop.once:
                tween.setLoopOnce();
                break;

            case LTLoop.pingpong:
                tween.setLoopPingPong();
                break;
            }

            tween.setOnComplete(doOnComplete);
            tween.setOnUpdate(doOnUpdate);
            tween.setUseEstimatedTime(useEstimatedTime.Value);
            tween.setUseFrames(useFrames.Value);
        }
Beispiel #26
0
    public void StartAnimCoin(float velCoin, float timeSpawnCoin, float velRotationCoin, Vector3 vCoinRotation)
    {
        if (posCoin.childCount <= 0)
        {
            return;
        }

        matCoin.SetFloat("_Transparency", 1f);
        _coin.transform.localPosition = Vector3.zero;

        _coin.GetComponent <RotationMovement>().StartRotation(velRotationCoin, vCoinRotation);

        Vector3 firstPoint = new Vector3(_coin.transform.localPosition.x, _coin.transform.localPosition.y + 2f, _coin.transform.localPosition.z);
        Vector3 lastPoint  = new Vector3(firstPoint.x, firstPoint.y - .6f, firstPoint.z);

        // Escalar y fade al aparecer moneda
        LeanTween.scale(_coin, Vector3.one, velCoin / 4).
        setOnUpdate((float f) =>
        {
            matCoin.SetFloat("_Transparency", 1 - f);
        });

        // Movimiento hacia arriba
        LeanTween.moveLocal(_coin, firstPoint, velCoin).setEase(LeanTweenType.easeOutSine).setOnComplete(() =>
        {
            // Espera para el siguiente movimiento
            LeanTween.delayedCall(.2f, () =>
            {
                // Movimiento hacia abajo
                LeanTween.moveLocal(_coin, lastPoint, velCoin / 3).setOnComplete(() =>
                {
                    matCoin.SetFloat("_Transparency", 1f);
                    LeanTween.delayedCall(timeSpawnCoin, () => { StartAnimCoin(velCoin, timeSpawnCoin, velRotationCoin, vCoinRotation); });
                }).setOnUpdate((float f) =>
                {
                    matCoin.SetFloat("_Transparency", f);
                });;
            });
        });
    }
Beispiel #27
0
    public void Start()
    {
        // Jump up
        var seq = LeanTween.sequence();

        seq.append(LeanTween.moveY(avatar1, avatar1.transform.localPosition.y + 6f, 1f).setEaseOutQuad());

        // Power up star, use insert when you want to branch off from the regular sequence (this does not push back the delay of other subsequent tweens)
        seq.insert(LeanTween.alpha(star, 0f, 1f));
        seq.insert(LeanTween.scale(star, Vector3.one * 3f, 1f));

        // Rotate 360
        seq.append(LeanTween.rotateAround(avatar1, Vector3.forward, 360f, 0.6f).setEaseInBack());

        // Return to ground
        seq.append(LeanTween.moveY(avatar1, avatar1.transform.localPosition.y, 1f).setEaseInQuad());

        // Kick off spiraling clouds - Example of appending a callback method
        seq.append(() => {
            for (int i = 0; i < 50f; i++)
            {
                GameObject cloud              = Instantiate(dustCloudPrefab) as GameObject;
                cloud.transform.parent        = avatar1.transform;
                cloud.transform.localPosition = new Vector3(Random.Range(-2f, 2f), 0f, 0f);
                cloud.transform.eulerAngles   = new Vector3(0f, 0f, Random.Range(0, 360f));

                var range = new Vector3(cloud.transform.localPosition.x, Random.Range(2f, 4f), Random.Range(-10f, 10f));

                // Tweens not in a sequence, because we want them all to animate at the same time
                LeanTween.moveLocal(cloud, range, 3f * speedScale).setEaseOutCirc();
                LeanTween.rotateAround(cloud, Vector3.forward, 360f * 2, 3f * speedScale).setEaseOutCirc();
                LeanTween.alpha(cloud, 0f, 3f * speedScale).setEaseOutCirc().setDestroyOnComplete(true);
            }
        });

        // You can speed up or slow down the sequence of events
        seq.setScale(speedScale);

        // seq.reverse();
    }
Beispiel #28
0
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.T))
            {
#if CUSTOM_LEAN_TWEEN
                initialPos = triggerButton.transform.localPosition;
                LeanTween.moveLocal(triggerButton, triggerButton.transform.localPosition - new Vector3(0, 0, 0.004f), 0.2f);
#endif
            }

            if (Input.GetKeyUp(KeyCode.T))
            {
#if CUSTOM_LEAN_TWEEN
                LeanTween.moveLocal(triggerButton, initialPos, 0.2f);
#endif
            }

            //    if (Input.GetKeyDown(KeyCode.H))
            //    {
            //        tempRenderer = homeButton.GetComponent<MeshRenderer>();
            //        tempRenderer.material.color = Color.red;
            //    }

            //    if (Input.GetKeyDown(KeyCode.B))
            //    {
            //        tempRenderer = backButton.GetComponent<MeshRenderer>();
            //        tempRenderer.material.color = Color.red;
            //    }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                meshRenderer = touchPadButton.GetComponent <MeshRenderer>();
                meshRenderer.material.color = Color.red;
            }

            if (Input.GetKeyUp(KeyCode.H) || Input.GetKeyUp(KeyCode.B) || Input.GetKeyUp(KeyCode.Q))
            {
                meshRenderer.material.color = Color.white;
            }
        }
    public void TryPopCharacter()
    {
        if (waitingPeople.Count < 6)
        {
            GameObject character = Instantiate(characterPrefabs[UnityEngine.Random.Range(0, characterPrefabs.Count)], transform);
            character.transform.position = popZone.position;
            character.GetComponentInChildren <Renderer>().sortingOrder = Mathf.RoundToInt(character.transform.position.y * 100f) * -1;
            //character.transform.localScale = Vector3.one;
            Animator animator = character.GetComponentInChildren <Animator>();
            animator.SetBool("IsWalking", true);
            animator.SetBool("IsLookingLeft", !isLeftSide);
            waitingPeople.Add(character);

            Vector3 dest = popZone.localPosition * (waitingPeople.Count * 1f / 6);
            float   dist = (dest - popZone.position).magnitude;

            LeanTween.moveLocal(character, dest, dist * .1f)
            .setOnComplete(() => { animator.SetBool("IsWalking", false); });
        }

        Invoke("TryPopCharacter", Random.Range(1f, 3f));
    }
    private IEnumerator DoSomething()
    {
        Debug.Log("Hi");



        if (trueFalsePositon == true)
        {
            LeanTween.moveLocal(leenMeanTweeenGreen, new Vector3(0.0f, 0.4f, 0), 0.5f);
        }
        else
        {
            LeanTween.moveLocal(leenMeanTweeenGreen, new Vector3(0.0f, 2.0f, 0), 0.5f);
        }


        yield return(new WaitForSeconds(1f));

        trueFalsePositon = !trueFalsePositon;

        isLogging = false;
    }