예제 #1
0
    private IEnumerator Animate()
    {
        if (Layer.OldLayer != Layer.OtherLayer)
        {
            LayerSetter.SetAllLayerRecursively(gameObject, Layer.OtherLayer);
        }

        SetPlayerMotion(false);

        Transform tweenTarget = LinkedEquipment.transform;

        if (LinkedEquipment as EquipmentAsGui)
        {
            tweenTarget = Player.transform;
        }

        TweenParms parms = new TweenParms();

        parms.Prop("position", new PlugVector3(tweenTarget.position));
        parms.Prop("rotation", new PlugQuaternion(tweenTarget.rotation));
        parms.Prop("localScale", new PlugVector3(tweenTarget.localScale));
        parms.Ease(EaseType.EaseInOutSine);

        HOTween.To(transform, TakeAnimationLength, parms);

        //dan
        //TODO
        //yield WaitForSeconds(TakeAnimationLength);
        yield return(new WaitForSeconds(TakeAnimationLength));

        SetPlayerMotion(true);

        LayerSetter.SetAllLayerRecursively(gameObject, Layer.OldLayer);
    }
예제 #2
0
        private void StartMooving(float movingDuration)
        {
            for (var i = 0; i < ItemList.Count; i++)
            {
                if (_targetItemPositionPathList[i].Count < 1)
                {
                    continue;
                }

                var param = new TweenParms();

                if (_targetItemPositionPathList[i].Count > 1)
                {
                    param.Prop("localPosition", new PlugVector3Path(_targetItemPositionPathList[i].ToArray()));
                }
                else
                {
                    param.Prop("localPosition", _targetItemPositionPathList[i][0]);
                }


                if (i == 0)
                {
                    HOTween.Kill();

                    param.OnStart(() => { IsScrollingInProcess = true; });
                    param.OnComplete(DetectCurrentItem);
                }


                HOTween.To(ItemList[i].transform, movingDuration, param);
            }
        }
    public void returnHome()
    {
        ParentHand = null;
        TweenParms parms = new TweenParms();

        parms.Prop("position", m_homeWorldPosition);
        parms.Prop("rotation", m_homeWorldRotation);
        parms.Ease(EaseType.EaseInOutExpo);
        parms.Delay(0.25f);
        parms.OnComplete(returnHomeCompleted);
        HOTween.To(transform, 0.5f, parms);
    }
예제 #4
0
    public void Move()
    {
        TweenParms parms = new TweenParms();

        //移动
        parms.Prop("localPosition", MovedPos);
        parms.Prop("localRotation", new Vector3(0, 0, 0));
        parms.Prop("localScale", new Vector3(1, 1, 1));
        //运动的类型
        parms.Ease(EaseType.EaseInOutCirc);
        //延迟一秒
        parms.Delay(0.1f);
        //执行动画
        HOTween.To(this.transform, 0.5f, parms);
    }
예제 #5
0
        public void reset()
        {
            TweenParms parms = new TweenParms();

            //移动
            parms.Prop("localPosition", oriPosition);
            parms.Prop("localRotation", oriRotation);
            parms.Prop("localScale", oriScale);
            //运动的类型
            parms.Ease(EaseType.EaseInOutCirc);
            //延迟一秒
            parms.Delay(0.1f);
            //执行动画
            HOTween.To(this.transform, 0.5f, parms);
        }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        onBeat     = false;
        retracting = false;

        transform.position = new Vector3(transform.position.x, transform.position.y - .5f, transform.position.z);

        //sets the original position
        origin.Prop("position", transform.position);
        origin.Ease(EaseType.Linear);

        //sets the target position
        switch (direction)
        {
        case DJ_Directions.Up:
            target.Prop("position", transform.position + new Vector3(0, 0, -maxDistance));
            break;

        case DJ_Directions.Down:
            target.Prop("position", transform.position + new Vector3(0, 0, maxDistance));
            break;

        case DJ_Directions.Left:
            target.Prop("position", transform.position + new Vector3(maxDistance, 0, 0));
            break;

        case DJ_Directions.Right:
            target.Prop("position", transform.position + new Vector3(-maxDistance, 0, 0));
            break;

        default:
            target.Prop("position", transform.position + new Vector3(0, 0, -maxDistance));
            break;
        }
        target.Ease(EaseType.Linear);


        _activationScript = GetComponent <DJ_BeatActivation>();
        fadeOutAlpha      = .3f;
        fadeOutGlow       = 0.6f;
        gameObject.GetComponent <Renderer>().material.SetFloat("_Alpha", 1);
        gameObject.GetComponent <Renderer>().material.SetFloat("_GlowStrength", 2);

        /*
         * gameObject.GetComponent<MeshRenderer>().enabled = false;
         * gameObject.GetComponent<BoxCollider>().enabled = false;
         */
    }
예제 #7
0
    private void Init(string tip)
    {
        imageObj = MonoBehaviour.Instantiate(Resources.Load("Tips/TipsImage")) as GameObject;
        imageObj.GetComponent <RectTransform>().SetParent(tipParent);
        imageObj.transform.localPosition = new Vector3(0, -100, 0);

        image         = imageObj.GetComponent <Image>();
        imageforblack = image.transform.Find("for more black").GetComponent <Image>();
        text          = imageforblack.transform.Find("my lable").GetComponent <Text>();

        text.text = tip;

        HOTween.Init();
        TweenParms parms = new TweenParms();

        parms.Prop("localPosition", new PlugVector3Y(50));
        parms.Ease(EaseType.EaseOutCubic);
        parms.Delay(0.1f);
        parms.OnComplete(MyComplete);
        HOTween.To(image.rectTransform, 1.5f, parms);

        #region Legacy DoTween
        //DOTween.Init();

        //Tweener tweener = image.rectTransform.DOMoveY(250f, 1f);
        //tweener.SetEase(Ease.Linear);

        //image.material.DOColor(Color.clear,1.5f);
        //text.material.DOColor(Color.clear, 1.5f);

        //tweener.OnComplete(MyComplete);
        #endregion
    }
예제 #8
0
    private void Show()
    {
        GoodsItemVO vo = currSelectedVO;

        //todo:根据数据初始化整个详情
        SetName(vo.name);
        SetOwn(vo.own);
        SetDetails(vo.description, vo.extraDescription);
        SetCost(vo.totalcost, vo.cout, vo.goodsCostType);
        Convert();

        if (temp == null)
        {
            this.mTrans.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            HOTween.Init();
            parms = new TweenParms();
            parms.Prop("localScale", new Vector3(1f, 1f, 1f));
            parms.Ease(EaseType.EaseOutBack);
            parms.Delay(0.1f);
            parms.AutoKill(false);
            temp       = HOTween.To(this.mTrans, 0.2f, parms);
            temp.intId = 1;
        }
        temp.PlayForward();
    }
예제 #9
0
    void SetPosition(bool isMotion)
    {
        //print ("SetPosition");
        //print ("isMotion="+isMotion);

        Vector3 pos = mLocalPosition;

        //print ("pos1="+pos);

        //print ("seq="+seq);


        pos += new Vector3(0f, seq * cellHeight, 0f);
        //print ("pos2="+pos);

        //pos -= new Vector3(0f, 300f, 0f);
        if (isMotion)
        {
            //print ("if isMotion");

            TweenParms parms = new TweenParms();
            parms.Prop("localPosition", pos);
            parms.Ease(EaseType.EaseOutCirc);
            HOTween.To(mTrans, 0.1f, parms);
            HOTween.Play();
        }
        else
        {
            //print ("else isMotion");

            mTrans.localPosition = pos;
        }
        //titleLabel.text = heros[seq].spriteName;
    }
예제 #10
0
    //creates a new HOTween tween which moves us to the next waypoint
    //(defined by passed arguments)
    internal void CreateTween()
    {
        //prepare HOTween's parameters, you can look them up here
        //http://www.holoville.com/hotween/documentation.html
        ////////////////////////////////////////////////////////////

        //create new HOTween plugin for curved paths
        //pass in array of Vector3 waypoint positions, relative = true
        plugPath = new PlugVector3Path(wpPos, true, pathtype);

        //orients the tween target along the path
        //constrains this game object on one axis
        if (orientToPath)
        {
            plugPath.OrientToPath();
        }

        //create TweenParms for storing HOTween's parameters
        tParms = new TweenParms();
        //sets the path plugin as tween position property
        tParms.Prop("position", plugPath);
        tParms.AutoKill(true);
        //use speed based tween with linear easing
        tParms.SpeedBased();
        tParms.Ease(EaseType.Linear);
        tParms.OnComplete(OnPathComplete);

        //create a new tween, move this gameobject with given arguments
        tween = HOTween.To(transform, maxSpeed, tParms);
    }
예제 #11
0
        public void ShowHideCard(bool hide)
        {
            var colliderEnabled = Collider.enabled;

            Collider.enabled = false;

            var param = new TweenParms();

            param.Prop("color", new Color(1, 1, 1, hide ? 1 : 0));

            param.OnComplete(() =>
            {
                Collider.enabled = colliderEnabled;

                if (OnShowCardFinished != null && !hide)
                {
                    OnShowCardFinished();
                    OnShowCardFinished = null;
                }
                if (OnHideCardFinished != null && hide)
                {
                    OnHideCardFinished();
                    OnHideCardFinished = null;
                }
            });


            HOTween.To(_lampOff, SHOW_HIDE_DURATION, param);
        }
예제 #12
0
        public bool CheckChar(char c)
        {
            if (BubbleGuessingCore.CurrentStage == null)
            {
                return(false);
            }

            var rightChar = BubbleGuessingCore.RealFindingWord[BubbleGuessingCore.CurrentFindingCharIndex];

            if (!char.ToUpper(c).Equals(char.ToUpper(rightChar)))
            {
                BubbleGuessingCore.UserData.ErrorCount++;

                if (BubbleGuessingCore.UserData.ErrorCount >= BubbleGuessingCore.CurrentStage.MaxErrorCount)
                {
                    //StartCoroutine(MoveNextStage(false));
                }

                UpdateErrorNumText();

                return(false);
            }

            var tweenCharIndex = BubbleGuessingCore.UseTemplate ? BubbleGuessingCore.Expression.Template.IndexOf(Const.UNKNOWN_CHAR, BubbleGuessingCore.CurrentFindingCharIndex + 1) : BubbleGuessingCore.CurrentFindingCharIndex;

            if (tweenCharIndex < 0)
            {
                tweenCharIndex = BubbleGuessingCore.CurrentFindingCharIndex;
            }

            if (!BubbleGuessingCore.UseTemplate)
            {
                HOTween.To(_charSpriteList[tweenCharIndex], _charShowDuration, "color", Color.white);
            }
            else
            {
                var param = new TweenParms();
                param.Prop("scale", Vector3.zero);

                param.OnComplete(() =>
                {
                    var pos = _charSpriteList[tweenCharIndex].gameObject.transform.localPosition;
                    PoolManager.Despawn(_charSpriteList[tweenCharIndex].gameObject);

                    var go = PoolManager.Spawn(_findingCharObject, transform);
                    go.transform.localPosition = pos;
                    var charSprite             = go.GetComponent <tk2dSprite>();
                    charSprite.SetSprite(Utils.GetCharSpriteName(BubbleGuessingCore.CurrentCharLibraryNameSequence, c));
                    charSprite.scale = Vector3.zero;
                    HOTween.To(charSprite, _charShowDuration, "scale", _findingCharObject.GetComponent <tk2dSprite>().scale);
                });

                HOTween.To(_charSpriteList[tweenCharIndex], _charShowDuration, param);
            }

            BubbleGuessingCore.CurrentFindingCharIndex++;

            return(true);
        }
예제 #13
0
        public void reset()
        {
            TweenParms parms = new TweenParms();

            //移动
            parms.Prop("localPosition", new Vector3(0, 0, 0));
            parms.Prop("localRotation", new Vector3(0, 0, 0));
            parms.Prop("localScale", new Vector3(1, 1, 1));
            //运动的类型
            parms.Ease(EaseType.EaseInOutCirc);
            //延迟一秒
            parms.Delay(0.1f);
            //执行动画
            HOTween.To(this.transform, 0.5f, parms);
            GetComponent <AudioSource>().clip = resetAudioClip;
            GetComponent <AudioSource>().Play();
        }
예제 #14
0
        public void Hide()
        {
            var param = new TweenParms();

            param.Prop("scale", Vector3.zero);
            param.OnComplete(() => { _lwf.Play(_hideAnimName); Picture.gameObject.SetActive(false); });

            HOTween.To(Picture, _pictureAnimDuration, param);
        }
        /// <summary>
        /// 摄像机开始阶段 移动
        /// </summary>
        private void EnterCameraMoveTask()
        {
            TweenParms parms = new TweenParms();

            parms.Prop("position", mCamInfo.mEndPos);
            Tweener tweener = HOTween.To(GameMethod.GetMainCamera.transform, mCamInfo.mNextTime, parms);

            tweener.easeType = EaseType.Linear;
        }
예제 #16
0
    public void tweenAndDisable(IntVector2 newPosition, Stack <Tile> tilesPool)
    {
        _tilesPool = tilesPool;
        TweenParms parms = new TweenParms();

        parms.Prop("position", _getPosition(newPosition, -10));
        parms.OnComplete(_deactivateGO);
        HOTween.To(gameObject.transform, MOVE_TWEEN_DURATION, parms);
    }
예제 #17
0
    private void TweenToGround(Vector3 groundPos)
    {
        TweenParms parms = new TweenParms();

        parms.Prop("position", groundPos);
        parms.Ease(EaseType.Linear);
        parms.OnComplete(OnTweenToGroundComplete);

        HOTween.To(gameObject.transform, 0.5f, parms);
    }
예제 #18
0
        private void StartFlyingAway(Bug bug)
        {
            var param = new TweenParms();

            var endPoint = new Vector3(_mv.BugSpawnPoint.position.x, _mv.BugSpawnPoint.position.y, bug.transform.position.z);

            param.Prop("position", endPoint);
            param.OnComplete(() => { PoolManager.Despawn(bug.gameObject); SetBugCountText(); });

            HOTween.To(bug.transform, FLYING_AWAY_DURATION, param);
        }
예제 #19
0
    void Start()
    {
        HOTween.Init(true, true, true);
        HOPath     path  = GetComponent <HOPath>();
        TweenParms param = new TweenParms();

        param.Prop("position", path.MakePlugVector3Path(), true);
        param.Loops(-1, type);
        param.Ease(easeType);
        HOTween.To(transform, time, param);
    }
예제 #20
0
    public Tweener SetMove(Vector3 targetPos, float during, EaseType type, Holoville.HOTween.Core.TweenDelegate.TweenCallback call)
    {
        TweenParms parms = new TweenParms();

        parms.Prop("position", targetPos);
        parms.OnComplete(call);
        Tweener tweener = HOTween.To(transform, during, parms);

        tweener.easeType = type;
        return(tweener);
    }
예제 #21
0
    private void TweenToWallCenter(Vector3 wallPieceViewPos)
    {
        Vector3 pos = transform.position;

        TweenParms parms = new TweenParms();

        parms.Prop("position", new Vector3(wallPieceViewPos.x, pos.y, wallPieceViewPos.z));
        parms.Ease(EaseType.Linear);
        parms.OnComplete(OnTweenToWallCenterComplete);

        HOTween.To(gameObject.transform, 0.5f, parms);
    }
예제 #22
0
    private void TweenToWallHeight(WallPieceView wallPieceView)
    {
        Vector3 pos = transform.position;

        TweenParms parms = new TweenParms();

        parms.Prop("position", new Vector3(pos.x, wallPieceView.Height, pos.z));
        parms.Ease(EaseType.Linear);
        parms.OnComplete(OnTweenToWallHeightComplete, wallPieceView.transform.position);

        HOTween.To(gameObject.transform, 0.5f, parms);
    }
예제 #23
0
    private void Fade()
    {
        Color color = renderer.material.color;

        TweenParms parms = new TweenParms();

        parms.Prop("color", new Color(color.r, color.g, color.b, 0));
        parms.Ease(EaseType.Linear);
        parms.OnComplete(OnFadeComplete);

        HOTween.To(renderer.material, 10.0f, parms);
    }
예제 #24
0
        private void MoveObjectBack()
        {
            var c = _dragObject.GetComponentInChildren <SphereCollider>();

            c.enabled = false;

            var param = new TweenParms();

            param.Prop("position", _dragStartPosition);
            param.OnComplete(() => c.enabled = true);

            HOTween.To(_dragObject.transform, MOVE_DURATION, param);
        }
예제 #25
0
        private void ShowHideSprite(tk2dSprite sprite, bool isShow, Action onComplete)
        {
            var param = new TweenParms();

            param.Prop("color", isShow ? Const.WhiteColor : Const.TransperentWhiteColor);

            if (onComplete != null)
            {
                param.OnComplete(() => onComplete());
            }

            HOTween.To(sprite, SHOW_HIDE_DURATION, param);
        }
예제 #26
0
        private void ScaleRoot(bool isOut)
        {
            var param = new TweenParms();

            if (!isOut)
            {
                param.Delay(UnityEngine.Random.Range(_scaleDelayRange.x, _scaleDelayRange.y));
            }
            param.Prop("localScale", isOut ? Vector3.zero : Vector3.one);
            param.Ease(EaseType.Linear);
            param.OnComplete(() => transform.localPosition = _initialPosition);

            HOTween.To(transform, SCALE_DURATION, param);
        }
예제 #27
0
    // Use this for initialization
    void Start()
    {
        //Tween Parameters
        initSclHeader = new Vector3(0.0f, 1.0f, 1.0f);
        initSclBody   = new Vector3(1.0f, 0.0f, 1.0f);
        initPosHeader = new Vector3(10.0f, 0.0f, 0.0f);
        initPosBody   = new Vector3(-5.0f, 5.0f, 0.0f);

        //Expand
        paramHeader.Prop("localScale", panelHeader.transform.localScale);
        paramHeader.Prop("position", panelHeader.transform.position);
        paramHeader.Ease(EaseType.EaseOutQuad);
        paramHeader.Delay(0.5f);

        paramBody.Prop("localScale", panelBody.transform.localScale);
        paramBody.Prop("position", panelBody.transform.position);
        paramBody.Ease(EaseType.EaseOutQuad);
        paramBody.Delay(0.8f);

        //Shrink
        paramBodyR.Prop("localScale", initSclBody);
        paramBodyR.Prop("position", initPosBody);
        paramBodyR.Ease(EaseType.EaseOutQuad);
        paramBodyR.Delay(0.5f);

        paramHeaderR.Prop("localScale", initSclHeader);
        paramHeaderR.Prop("postision", initPosHeader);
        paramHeaderR.Ease(EaseType.EaseOutQuad);
        paramHeaderR.Delay(0.8f);


        //Panel Initial State
        panelHeader.transform.localScale = initSclHeader;
        panelBody.transform.localScale   = initSclBody;
        panelHeader.transform.position   = initPosHeader;
        panelBody.transform.position     = initPosBody;
    }
예제 #28
0
    //-------------------------------------------------------------------------------------
    // Update
    //-------------------------------------------------------------------------------------
    void Update()
    {
        switch (m_Rno)
        {
        case 0:
        {
            m_Rno = 1;

            // jump
            var parms = new TweenParms();
            parms.Prop("position", new Vector3(0, 2, 0), true);
            parms.Ease(EaseType.EaseInOutQuint);
            parms.Loops(2, LoopType.Yoyo);

            m_Tweener = HOTween.To(this.transform, 0.6f, parms);

            // rolling
            var parms2 = new TweenParms();
            var angle  = this.transform.eulerAngles;
            angle.x += 180.0f;

            parms2.Prop("eulerAngles", new Vector3(360, 0, 0));
            parms2.Ease(EaseType.EaseInOutQuint);

            HOTween.To(this.transform, 1.2f, parms2);
        }
        break;

        case 1:
        {
            if (m_Tweener.isComplete)
            {
                m_Rno   = 2;
                m_Timer = 0.10f;
            }
        }
        break;

        case 2:
        {
            m_Timer -= Time.deltaTime;
            if (m_Timer < 0.0f)
            {
                m_Rno = 0;
            }
        }
        break;
        }
    }
예제 #29
0
    private void TweenOffWall(WallPieceView wallPieceView, Vector3 direction)
    {
        Vector3 target = (wallPieceView.transform.position + new Vector3(0, wallPieceView.Height, 0)) + (direction * GameConfig.BLOCK_SIZE) * (0.75f);

        Vector3 aboveGroundPos = wallPieceView.transform.position + (direction * GameConfig.BLOCK_SIZE);
        Vector3 groundPos      = new Vector3(aboveGroundPos.x, 0, aboveGroundPos.z);

        TweenParms parms = new TweenParms();

        parms.Prop("position", target);
        parms.Ease(EaseType.Linear);
        parms.OnComplete(OnTweenOffWallComplete, groundPos);

        HOTween.To(gameObject.transform, 0.5f, parms);
    }
예제 #30
0
    public override void FireEvent()
    {
        if (tweener != null)
        {
            return;
        }

        TweenParms parms = new TweenParms();

        parms.Prop(fieldName, GetTargetValue());
        parms.Ease(easeType);
        parms.AutoKill(false);

        tweener = HOTween.To(TargetComponent, Duration, parms);
    }