示例#1
1
    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);
    }
示例#2
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 );
    }
    private IEnumerator AnimateReveal()
    {
        float time = 3f;

        CreateSphereCollider();
        GameObject randomPower = null;

        while (randomPower == null) {
            randomPower = GetRandomSpiritPower();
            yield return new WaitForSeconds(1f);
        }
        var rotation = RotateAt45Degrees ? Quaternion.Euler(45f, 0f, 45f) : Quaternion.identity;
        var spiritPowerGO = (GameObject)GameObject.Instantiate(randomPower, AttachedSpiritPowerPosition(), rotation);
        _attachedSpiritPower = spiritPowerGO.GetComponent<CollectableSpiritPower>();
        spiritPowerGO.transform.parent = gameObject.transform;

        //Move up
        TweenParms revealTween = new TweenParms().Prop(
            "position", transform.position + Vector3.up * buryDepth).Ease(
            EaseType.Linear).Delay(0f);
        HOTween.To(gameObject.transform, time, revealTween);

        //Scale power
        var targetScale = spiritPowerGO.transform.localScale;
        spiritPowerGO.transform.localScale = new Vector3(0f, 0f, 0f);

        TweenParms scaleTween = new TweenParms().Prop(
            "localScale", targetScale).Ease(
            EaseType.EaseInOutElastic).Delay(2.5f);
        HOTween.To(spiritPowerGO.transform, 1f, scaleTween);

        yield return new WaitForSeconds(time);
        _active = true;
    }
示例#4
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    
    }
示例#5
0
 public void DamageEffect()
 {
     damageSprite.color = new Color(1f, 1f, 1f, 0f);
     damageSprite.enabled = true;
     TweenParms parms = new TweenParms().Prop("color", new Color(1f,1f,1f,0.5f)).Ease(EaseType.Linear).Loops(2,LoopType.Restart).OnComplete(DoneDamageEffect);
     HOTween.To(damageSprite, 0.05f, parms);
 }
示例#6
0
    private IEnumerator AnimateReveal()
    {
        float time = 3f;

        CreateSphereCollider();
        var randomItem = Items[Random.Range(0, Items.Length)];
        var itemGO = (GameObject) GameObject.Instantiate(randomItem, transform.position + new Vector3(0f, 1.6f, 0f), Quaternion.LookRotation(Vector3.right));
        _attachedItem = itemGO.GetComponent<Collectable>();
        itemGO.transform.parent = gameObject.transform;

        //Move up
        TweenParms revealTween = new TweenParms().Prop(
            "position", transform.position + Vector3.up * buryDepth).Ease(
            EaseType.Linear).Delay(0f);
        HOTween.To(gameObject.transform, time, revealTween);

        //Scale power
        var targetScale = itemGO.transform.localScale;
        itemGO.transform.localScale = new Vector3(0f, 0f, 0f);

        TweenParms scaleTween = new TweenParms().Prop(
            "localScale", targetScale).Ease(
            EaseType.EaseInOutElastic).Delay(2.5f);
        HOTween.To(itemGO.transform, 1f, scaleTween);

        yield return new WaitForSeconds(time);
        _active = true;
    }
示例#7
0
	public U9HOTweenTransition( HOTweenDelegate tweenDelegate, object go, float duration, TweenParms args ) 
	{
		this.tweenDelegate = tweenDelegate;
		this.go = go;
		this.args = args;
		this.duration = duration;
	}
示例#8
0
    public void Init()
    {
        TweenParms tParams = new TweenParms();
        tParams.Prop("position", new Vector3(0, 3.6f));

        HOTween.To(transform, 0.5f, tParams);
    }
示例#9
0
 void SetHealthPoint(float point)
 {
     if (point<0f) point = 1f;
     if (point>1f) point = 1f;
     TweenParms parms = new TweenParms().Prop("sliderValue", point).Ease(EaseType.EaseOutQuart);
     HOTween.To(hpBar, 0.1f, parms );
     healthPoint = point;
 }
示例#10
0
 public static void Start(Transform[] ts, Vector3[] to)
 {
     Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo);
     for (int i = 0; i < ts.Length; ++i)
     {
         HOTween.To(ts[i], 1, tp.NewProp("position", to[i]));
     }
 }
示例#11
0
 public static void Start(SampleClass[] cs, float[] to)
 {
     Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo);
     for (int i = 0; i < cs.Length; ++i)
     {
         HOTween.To(cs[i], 1, tp.NewProp("floatVal", to[i]));
     }
 }
示例#12
0
 void Start()
 {
     Vector3 pos = transform.position - Vector3.up * 0.005f;
     TweenParms parms = new TweenParms().Prop("position", pos).Ease(EaseType.Linear).Loops(-1, LoopType.Yoyo);
     HOTween.To(transform, time, parms );
     Quaternion rot = Quaternion.Euler(0f, 0f, 1f);
     parms = new TweenParms().Prop("rotation", rot).Ease(EaseType.Linear).Loops(-1, LoopType.Yoyo);
     HOTween.To(transform, time, parms );
 }
示例#13
0
 private void startTransfer(Vector3 target)
 {
     moving = true;
     TweenParms parms = new TweenParms ();
     parms.Prop ("position", target);
     parms.OnComplete (endTransfer);
     parms.Ease (EaseType.Linear);
     float moveTime = Vector3.Magnitude (transform.position - target) / speed;
     HOTween.To (transform, moveTime, parms);
 }
示例#14
0
    public override void build(AMSequence seq, AMTrack track, int index, UnityEngine.Object obj)
    {
        Transform target = obj as Transform;

        int frameRate = seq.take.frameRate;

        //allow tracks with just one key
        if(track.keys.Count == 1)
            interp = (int)Interpolation.None;

        if(!canTween) {
            switch((track as AMRotationEulerTrack).axis) {
                case AMRotationEulerTrack.Axis.X:
                    seq.Insert(new AMActionTransLocalRotEulerX(this, frameRate, target, rotation.x));
                    break;
                case AMRotationEulerTrack.Axis.Y:
                    seq.Insert(new AMActionTransLocalRotEulerY(this, frameRate, target, rotation.y));
                    break;
                case AMRotationEulerTrack.Axis.Z:
                    seq.Insert(new AMActionTransLocalRotEulerZ(this, frameRate, target, rotation.z));
                    break;
                default:
                    seq.Insert(new AMActionTransLocalRotEuler(this, frameRate, target, rotation));
                    break;
            }
        }
        else if(endFrame == -1) return;
        else {
            Vector3 endRotation = (track.keys[index + 1] as AMRotationEulerKey).rotation;

            TweenParms tParms = new TweenParms();

            switch((track as AMRotationEulerTrack).axis) {
                case AMRotationEulerTrack.Axis.X:
                    tParms = tParms.Prop("rotation", new AMPlugToTransformLocalEulerX(target, endRotation.x));
                    break;
                case AMRotationEulerTrack.Axis.Y:
                    tParms = tParms.Prop("rotation", new AMPlugToTransformLocalEulerY(target, endRotation.y));
                    break;
                case AMRotationEulerTrack.Axis.Z:
                    tParms = tParms.Prop("rotation", new AMPlugToTransformLocalEulerZ(target, endRotation.z));
                    break;
                default:
                    tParms = tParms.Prop("rotation", new AMPlugToTransformLocalEuler(target, endRotation));
                    break;
            }

            if(hasCustomEase())
                tParms = tParms.Ease(easeCurve);
            else
                tParms = tParms.Ease((EaseType)easeType, amplitude, period);

            seq.Insert(this, HOTween.To(this, getTime(frameRate), tParms));
        }
    }
示例#15
0
 public void ShowChoice(float t)
 {
     SetChoice();
     StartCoroutine(DelayAction(t, () =>
     {
         UnSetChoice();
     }));
     shapeRenderer.transform.localScale = Vector3.one;
     TweenParms parms = new TweenParms().Prop("localScale", Vector3.one * 1.1f).Ease(EaseType.EaseOutElastic).Loops(2,LoopType.Yoyo);
     HOTween.To(shapeRenderer.transform, 0.1f, parms);
 }
	public void Init(Vector3 origin, Vector3 target)
	{
		_transform = transform;
		_origin = origin;
		_transform.position = origin;

		_tweenAlphaParms = new TweenParms().Prop("alpha",0f).OnComplete(ReturnToPoolEvent);
		_tweenPositionParms = new TweenParms().Prop("position",target);
		_label = GetComponent<UILabel>();
		gameObject.SetActive( false );
	}
示例#17
0
 IEnumerator BlackOut()
 {
     SpriteRenderer sr = this.gameObject.AddComponent<SpriteRenderer>();
     sr.sprite = whiteSprite;
     sr.color = Color.black;
     transform.localScale = Vector2.one * 10000;
     sr.sortingLayerName = "Character";
     sr.sortingOrder = 1000;
     yield return new WaitForSeconds (0.1f);
     TweenParms parms = new TweenParms().Prop("color", new Color(0,0,0,0));
     HOTween.To (sr,0.5f,parms);
 }
示例#18
0
	// Use this for initialization
	void Start () 
	{
        _tweenparms = new TweenParms()
           .Prop("rotation", new Vector3(0, 180, 0))
           .Ease(EaseType.EaseInOutQuad)
           .Loops(-1, LoopType.Yoyo);

        _tweener = HOTween.To(this.transform, 4, _tweenparms);

        _tweener.Play();

        weapon.SetView(this);
	}
示例#19
0
 void AddEaseTypeOrAnimCurve(TweenParams _oParam)
 {
     if (gs_oParam.gs_oAnimCurve != null)
     {
         if (gs_oParam.gs_oAnimCurve.keys.Length > 0)
         {
             _oParam.Ease(gs_oParam.gs_oAnimCurve);
         }
     }
     else
     {
         _oParam.Ease(gs_oParam.gs_eEaseType);
     }
 }
    private void UpdateHearts()
    {
        float healthDisplayed = 0f;

        bool done = false;
        foreach (var heart in Hearts) {
            if (done) {
                heart.renderer.enabled = false;
                continue;
            }
            heart.renderer.enabled = true;
            //Full heart
            if (_player.Health - healthDisplayed > 1f) {
                heart.renderer.material = HeartFullMaterial;
            }
            //Half heart
            else if (_player.Health - healthDisplayed > 0f) {
                heart.renderer.material = HeartHalfMaterial;
            }
            //Empty heart
            else {
                heart.renderer.material = HeartEmptyMaterial;
            }
            healthDisplayed += 2f;

            if (healthDisplayed >= _player.FullHealth)
                done = true;
        }

        //Tween the hearts, that changed
        if (_healthPrevious != _player.Health) {
            var low = (_healthPrevious < _player.Health) ? _healthPrevious : _player.Health;
            var high = (_healthPrevious < _player.Health) ? _player.Health : _healthPrevious;
            for(int i = 0; i < Hearts.Length; i++) {
                if (low/2f < i + 1 && high/2f > i) {
                    TweenParms heartTweenStart = new TweenParms().Prop(
                        "localScale", _heartBaseScale * _tweenScale).Ease(
                        EaseType.EaseInBack).Delay(0f);
                    HOTween.To(Hearts[i].transform, 0.2f, heartTweenStart);

                    TweenParms heartTweenEnd = new TweenParms().Prop(
                        "localScale", _heartBaseScale).Ease(
                        EaseType.EaseInOutBack).Delay(0.2f);
                    HOTween.To(Hearts[i].transform, 0.2f, heartTweenEnd);
                }
            }
        }
        _healthPrevious = _player.Health;
    }
示例#21
0
 void Roll()
 {
     if (isRoll) return;
     isRoll = true;
     float dist = mousePos.x - Input.mousePosition.x;
     float sign = Mathf.Sign(dist);
     if (Mathf.Abs(dist) < 4f) Application.LoadLevel("Game" + seq);
     int t = seq + (int)sign;
     seq = (t + 3) % 3;
     Vector3 rot = new Vector3(0f, 120f * t, 0f);
     TweenParms tparms = new TweenParms().Prop("eulerAngles", rot).Ease(EaseType.EaseInOutQuad).Id("myTween");
     tparms.OnComplete(OnDoneRollEffect);
     HOTween.Kill("myTween");
     HOTween.To(tr, 0.5f, tparms);
 }
示例#22
0
    void MoveCamera(Vector2 newPosition)
    {
        if (Mathf.Approximately(newPosition.x, 0))
            newPosition.x = 0;

        if (Mathf.Approximately(newPosition.y, 0))
            newPosition.y = 0;

        isMoving = true;
        TweenParms p = new TweenParms();
        p.Prop ("position", new Vector3 (newPosition.x, newPosition.y, this.transform.position.z));
        Debug.Log ("newpos: " + new Vector3 (newPosition.x, newPosition.y, this.transform.position.z));
        p.OnComplete (setNotMoving);
        HOTween.To (this.transform, 1, p);
    }
示例#23
0
        // ***********************************************************************************
        // CONSTRUCTOR + PARMS CREATOR
        // ***********************************************************************************

        /// <summary>
        /// Called by HOTween each time a new tween is generated via <c>To</c> or similar methods.
        /// </summary>
        internal Tweener(object p_target, float p_duration, TweenParms p_parms)
        {
            _target   = p_target;
            _duration = p_duration;

            p_parms.InitializeObject(this, _target);

            if (plugins != null && plugins.Count > 0)
            {
                // Valid plugins were added: mark this as not empty anymore.
                _isEmpty = false;
            }

            SetFullDuration();
        }
示例#24
0
    void OnTriggerEnter(Collider other)
    {
        if (gameObject == GameController.GetInstance().CurrentPlayerTrigger && other.CompareTag("Mist"))
        {
            List<GameObject> MistList = new List<GameObject>();
            List<GameObject> MistOtherList = new List<GameObject>();
            int MistCount;
            int RecoverCount;
            MistName = other.gameObject.name.Substring(start - 1, length);//获取迷雾物体的前缀
            MistArray = other.gameObject.name.Split('_');//分割迷雾名称
            MistType = MistArray[1];//获取迷雾物体的名字中的类型
            foreach (Transform child in Mist.transform)
            {
                MistChild = child.gameObject.name.Split('_');
                if (child.gameObject.name.Substring(start - 1, length) == MistName || (MistType == "Elevator" && MistChild[2] == MistArray[2]))
                {
					//如果子物体名称一致
                    MistList.Add(child.gameObject);
                }
                else
                {
                    MistOtherList.Add(child.gameObject);
                }
            }
            for (MistCount = 0; MistCount < MistList.Count; MistCount++)
            {
                if (MistList[MistCount].GetComponent<tk2dSprite>().color != new Color(1, 1, 1, 0))
                {
                    TweenParms CleanMist = new TweenParms();
                    //颜色Aplaha通道渐变至0
                    CleanMist.Prop("color", new Color(1, 1, 1, 0));
                    //回调函数
                    HOTween.To(MistList[MistCount].GetComponent<tk2dSprite>(), 0.5f, CleanMist);
                }
            }
            for (RecoverCount = 0; RecoverCount < MistOtherList.Count; RecoverCount++)
            {
                if (MistOtherList[RecoverCount].GetComponent<tk2dSprite>().color != new Color(1, 1, 1, 1))
                {
                    TweenParms RecoverMist = new TweenParms();
                    //颜色Aplaha通道渐变至0
                    RecoverMist.Prop("color", new Color(1, 1, 1, 1));
                    //回调函数
                    HOTween.To(MistOtherList[RecoverCount].GetComponent<tk2dSprite>(), 0.5f, RecoverMist);
                }
            }
        }
    }
    void MoveNext()
    {
        if (pathController.IsEndReached(currentCheckPoint) == false)
        {
            TweenParms paramaters = new TweenParms().Prop("position", pathController.CheckPoint(currentCheckPoint + 1)).Ease(EaseType.Linear).OnComplete(MoveNext);

            Tweener tweener = HOTween.To(this.transform, 2, paramaters);

            tweener.Play();

            currentCheckPoint++;
        }
        else
        {
            _monster.CommitSuicide();
        }
    }
	void MoveNext()
	{
		if (pathController.IsEndReached(_currentCheckPoint) == false)
		{
            TweenParms paramaters = new TweenParms().Prop("position", pathController.CheckPoint(_currentCheckPoint + 1)).Ease(EaseType.Linear).OnComplete(MoveNext);
			
			_tweener = HOTween.To(_transform, 2, paramaters);
			
			_tweener.Play();
			
			_currentCheckPoint++;
		}
		else
		{
            OnPathEnded();
		}
	}
示例#27
0
    private IEnumerator TweenText()
    {
        _wantedRotationUp = Vector3.up;

        transform.localScale *= 0f;
        gameObject.renderer.enabled = true;

        TweenParms popOutTween = new TweenParms().Prop(
            "localScale", _baseScale).Prop(
            "position", _initPosition + Vector3.up).Ease(
            EaseType.EaseOutBounce).Delay(0f);
        HOTween.To(gameObject.transform, 0.3f, popOutTween);

        yield return new WaitForSeconds(0.3f);
        transform.parent = _mainCamera.transform;

        //Is there already another?
        var popups = FindObjectsOfType<PopUpText>();
        _targetPosition = new Vector3(0f, 0.2f, 4f);
        foreach (var popup in popups) {
            if (!popup.gameObject.Equals(this.gameObject) && popup.InitTime < InitTime) {
                //print("wut");
                _targetPosition = new Vector3(0f, 1f, 4f);
            }
        }
        _wantedRotationUp = _mainCamera.transform.up;
        TweenParms moveToCameraTween = new TweenParms().Prop(
            "localPosition", _targetPosition).Ease(
            EaseType.EaseInOutQuint).Delay(0f);
        HOTween.To(gameObject.transform, 0.6f, moveToCameraTween);

        yield return new WaitForSeconds(1.5f);

        _wantedRotationUp = (_pickUpPlayer == Hero.Player.One ? Vector3.left : Vector3.right);
        _targetPosition += Vector3.down * 10f + (_pickUpPlayer == Hero.Player.One ? Vector3.left * 1.4f : Vector3.right * 1.4f) * 10f;

        TweenParms moveAwayTween = new TweenParms().Prop(
            "localPosition", _targetPosition).Ease(
            EaseType.EaseInCirc).Delay(0f);
        HOTween.To(gameObject.transform, 0.4f, moveAwayTween);

        yield return new WaitForSeconds(1f);
        Destroy(gameObject);

        yield return null;
    }
示例#28
0
    public void Move(Vector3 target)
    {
        if(Moving) return;

        Vector3 from = gameObject.transform.position;

        OnMoveBegin(from, target);

        TweenParms parms = new TweenParms();
        parms.Ease(EaseType.Linear);
        parms.Prop("position", target);
        parms.OnComplete(OnMoveComplete, from, target);

        Moving = true;

        HOTween.To(gameObject.transform, 0.5f, parms);
    }
示例#29
0
    /// <summary>
    /// Move Tween
    /// </summary>
    void MoveTo()
    {
        if (gs_oParam.gs_vMoveFrom == null)
        {
            bool worldSpace = gs_oParam.gs_bWorldSpace;
            if (worldSpace == true)
            {
                gs_oParam.MoveFrom(m_oOwner.position);
            }
            else
            {
                gs_oParam.MoveFrom(m_oOwner.localPosition);
            }
        }

        if (gs_oParam.gs_vMoveTo == null || gs_oParam.gs_fDuration == null)
        {
            return;
        }

        string propTarget = string.Empty;

        if (gs_oParam.gs_bWorldSpace == true)
        {
            m_oOwner.position = gs_oParam.gs_vMoveFrom.Value;
            propTarget        = "position";
        }
        else
        {
            m_oOwner.localPosition = gs_oParam.gs_vMoveFrom.Value;
            propTarget             = "localPosition";
        }

        TweenParams param = new TweenParams().Prop(propTarget, gs_oParam.gs_vMoveTo.Value, false).
                            Delay(gs_oParam.gs_fDelay).
                            OnStepComplete(gs_oParam.m_onFinish).
                            AutoKill(true);

        AddEaseTypeOrAnimCurve(param);

        HOTween.To(m_oOwner, gs_oParam.gs_fDuration.Value, param);
    }
    public void ActivateTrigger(Vector3 target, Hero triggerer, SpiritImmortal powerSource)
    {
        _isActivated = true;
        _originPosition = transform.position;
        _targetPosition = target;
        _triggerer = triggerer;
        _powerSource = powerSource;
        _startTime = Time.time;
        _expiresTimer = _startTime + _expiresAfter;
        TriggerColorBase = triggerer.GetComponentInChildren<Projector>().material.GetColor("_Color");
        TriggerColorCurrent = TriggerColorBase;

        //Tween in landing
        Vector3 targetScale = gameObject.transform.localScale;
        gameObject.transform.localScale *= 0.5f;
        TweenParms tweenParms = new TweenParms().Prop(
            "localScale", targetScale).Ease(
            EaseType.EaseInCirc).Delay(0f);
        HOTween.To(gameObject.transform, _timeToDestination, tweenParms);
    }
示例#31
0
    void JumpMotion()
    {
        animator.SetTrigger("Jump");

        SequenceParms sparams = new SequenceParms(); //.OnComplete(gameObject, "OnCompleteJump");
        Sequence mySequence = new Sequence(sparams);
        TweenParms parms;

        tf.position = startPosition;

        parms = new TweenParms().Prop("position", startPosition).Ease(EaseType.EaseOutQuad).OnComplete(OnDoneTakeOff);
        mySequence.Append(HOTween.To(tf, 0.4f, parms));

        parms = new TweenParms().Prop("position", endPosition).Ease(EaseType.EaseOutQuad).OnComplete(OnDoneAir);
        mySequence.Append(HOTween.To(tf, 0.2f, parms));

        parms = new TweenParms().Prop("position", endPosition).Ease(EaseType.EaseOutQuad).OnComplete(OnDoneLanding);
        mySequence.Append(HOTween.To(tf, 0.6f, parms));

        mySequence.Play();
    }
示例#32
0
    /// <summary>
    /// Rotate Tween
    /// </summary>
    void RotateTo()
    {
        if (gs_oParam.gs_vScaleFrom == null)
        {
            gs_oParam.ScaleFrom(m_oOwner);
        }

        if (gs_oParam.gs_vRotateTo == null || gs_oParam.gs_fDuration == null)
        {
            return;
        }

        m_oOwner.localEulerAngles = gs_oParam.gs_vRotateFrom.Value;
        TweenParams param = new TweenParams().Prop("rotation", gs_oParam.gs_vRotateTo.Value, false).
                            Delay(gs_oParam.gs_fDelay).
                            OnStepComplete(gs_oParam.m_onFinish).
                            AutoKill(true);

        AddEaseTypeOrAnimCurve(param);

        HOTween.To(m_oOwner, gs_oParam.gs_fDuration.Value, param);
    }
示例#33
0
        /// <summary>
        /// Completely resets the Tweener except its target,
        /// and applies a new <see cref="TweenType"/>, duration, and <see cref="TweenParms"/>.
        /// </summary>
        /// <param name="p_tweenType">New tween type (to/from)</param>
        /// <param name="p_newDuration">New duration</param>
        /// <param name="p_newParms">New parameters</param>
        public void ResetAndChangeParms(TweenType p_tweenType, float p_newDuration, TweenParms p_newParms)
        {
            if (_destroyed)
            {
                TweenWarning.Log("ResetAndChangeParms can't run because the tween was destroyed - set AutoKill or autoKillOnComplete to FALSE if you want to avoid destroying a tween after completion");
                return;
            }
            Reset();
            _duration = p_newDuration;
            if (p_tweenType == TweenType.From)
            {
                p_newParms = p_newParms.IsFrom();
            }

            p_newParms.InitializeObject(this, _target);

            if (plugins != null && plugins.Count > 0)
            {
                // Valid plugins were added: mark this as not empty anymore.
                _isEmpty = false;
            }

            SetFullDuration();
        }
示例#34
0
	void OnTriggerEnter(Collider other){
		//用于触发小球跑到终点时候的场景切换
		if(other.name == "WinTag"){
			if(Global.GetInstance ().CurrentStayLevel == GameController.GetInstance ().CurrentLevelNum){
				for(i=0;i < GameController.GetInstance().Levels.Count; i++){
					if(GameController.GetInstance().Levels[i].LevelNum == Global.GetInstance ().CurrentStayLevel && (GameController.GetInstance ().TimeRecorder < GameController.GetInstance().Levels[i].LevelTime || GameController.GetInstance().Levels[i].LevelTime == 0)){
						GameController.GetInstance().Levels[i].LevelTime = GameController.GetInstance ().TimeRecorder;
						Global.GetInstance().CurrentLevelTime = GameController.GetInstance ().TimeRecorder;
					}else if(GameController.GetInstance().Levels[i].LevelNum == Global.GetInstance ().CurrentStayLevel && (GameController.GetInstance ().TimeRecorder >= GameController.GetInstance().Levels[i].LevelTime && GameController.GetInstance().Levels[i].LevelTime != 0)){
						Global.GetInstance().CurrentLevelTime = GameController.GetInstance().Levels[i].LevelTime;
					}
				}
				GameController.GetInstance ().CurrentLevelNum = GameController.GetInstance ().CurrentLevelNum + 1;
				GameController.GetInstance ().CurrentLevelSceneNum = GameController.GetInstance ().CurrentLevelNum % 5;
				if(GameController.GetInstance ().CurrentLevelSceneNum == 0){
					GameController.GetInstance ().CurrentLevelSceneNum = 5;
				}
				GameController.GetInstance().Levels.Add(
					new Level{
					LevelNum = GameController.GetInstance ().CurrentLevelNum,
					LevelScene = (GameController.GetInstance ().CurrentLevelNum - GameController.GetInstance ().CurrentLevelSceneNum %5)/5 + 1,
					LevelSceneNum = GameController.GetInstance ().CurrentLevelSceneNum,
					LevelLock = false,
					isCurrent = true,
					LevelTime = 0,
					LevelStars = 0
				}
				);
				if(Global.GetInstance().SelectedSave == 1 && ES2.Exists ("player01.dat")){
					ES2.Save(GameController.GetInstance ().CurrentLevelNum, "player01.dat?tag=CurrentLevelNum");
					ES2.Save(1, "player01.dat?tag=CurrentLevelScene");
					ES2.Save(GameController.GetInstance ().CurrentLevelSceneNum, "player01.dat?tag=CurrentLevelSceneNum");
				}else if(Global.GetInstance().SelectedSave == 2 && ES2.Exists ("player02.dat")){
					ES2.Save(GameController.GetInstance ().CurrentLevelNum, "player02.dat?tag=CurrentLevelNum");
					ES2.Save(1, "player02.dat?tag=CurrentLevelScene");
					ES2.Save(GameController.GetInstance ().CurrentLevelSceneNum, "player02.dat?tag=CurrentLevelSceneNum");
				}else if(Global.GetInstance().SelectedSave == 3 && ES2.Exists ("player03.dat")){
					ES2.Save(GameController.GetInstance ().CurrentLevelNum, "player03.dat?tag=CurrentLevelNum");
					ES2.Save(1, "player03.dat?tag=CurrentLevelScene");
					ES2.Save(GameController.GetInstance ().CurrentLevelSceneNum, "player03.dat?tag=CurrentLevelSceneNum");
				}
				for(i=0;i < GameController.GetInstance().Levels.Count; i++){
					if(GameController.GetInstance().Levels[i].LevelNum == Global.GetInstance ().CurrentStayLevel && GameController.GetInstance().Levels[i].isCurrent == true){
						GameController.GetInstance().Levels[i].isCurrent = false;
					}
				}
				Global.GetInstance().CurrentLevelTime = GameController.GetInstance ().TimeRecorder;
			}else{
				for(i=0;i < GameController.GetInstance().Levels.Count; i++){
					if(GameController.GetInstance().Levels[i].LevelNum == Global.GetInstance ().CurrentStayLevel && (GameController.GetInstance ().TimeRecorder < GameController.GetInstance().Levels[i].LevelTime || GameController.GetInstance().Levels[i].LevelTime == 0)){
						GameController.GetInstance().Levels[i].LevelTime = GameController.GetInstance ().TimeRecorder;
						Global.GetInstance().CurrentLevelTime = GameController.GetInstance ().TimeRecorder;
					}else if(GameController.GetInstance().Levels[i].LevelNum == Global.GetInstance ().CurrentStayLevel && (GameController.GetInstance ().TimeRecorder >= GameController.GetInstance().Levels[i].LevelTime && GameController.GetInstance().Levels[i].LevelTime != 0)){
						Global.GetInstance().CurrentLevelTime = GameController.GetInstance().Levels[i].LevelTime;
					}
				}
			}
			if(Global.GetInstance().SelectedSave == 1 && ES2.Exists ("player01.dat")){
				ES2.Save(GameController.GetInstance().Levels, "player01.dat?tag=LevelInfo");
			}else if(Global.GetInstance().SelectedSave == 2 && ES2.Exists ("player02.dat")){
				ES2.Save(GameController.GetInstance().Levels, "player02.dat?tag=LevelInfo");
			}else if(Global.GetInstance().SelectedSave == 3 && ES2.Exists ("player03.dat")){
				ES2.Save(GameController.GetInstance().Levels, "player03.dat?tag=LevelInfo");
			}
			TweenParms GameWin = new TweenParms ();
			//颜色Aplaha通道渐变至255(即屏幕渐渐变黑)
			GameWin.Prop ("color", new Color (1, 1, 1, 1));
			//回调函数GameOverScene
			GameWin.OnComplete (GameWinScene);
			HOTween.To (GameObject.Find ("over").gameObject.GetComponent<tk2dSprite> (), 0.5f, GameWin);
		}
		//用于检测小球触发到机器人时,将num检测值重置
		if (other.CompareTag("RobotTrigger") && other.GetComponent<RobotGameOver> ().isAvail == true) {
			num = 0;
		}
	}
示例#35
0
 void OnTriggerExit(Collider other)
 {
     if (gameObject.CompareTag("Player") && gameObject == GameController.GetInstance().CurrentPlayerTrigger && other.CompareTag("MistCut")){
         int Count;
         for (Count = 0; Count < MistAll.Count; Count++)
         {
             MistArray = MistAll[Count].name.Split('_');
             MistType = MistArray[1];
             if (MistAll[Count].GetComponent<tk2dSprite>().color == new Color(1, 1, 1, 0) && MistType != "Elevator")
             {
                 TweenParms CutMist = new TweenParms();
                 //颜色Aplaha通道渐变至0
                 CutMist.Prop("color", new Color(1, 1, 1, 1));
                 //回调函数
                 HOTween.To(MistAll[Count].GetComponent<tk2dSprite>(), 0.5f, CutMist);
             }
         }
     }
 }
示例#36
0
    void SetupTweens()
    {
        // Ease
        DG.Tweening.Ease           dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad;
        Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad;
        LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad;
        GoEaseType    goEase   = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut;

        iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad;
        // Loop
        int loops = testSetup == TestSetup.Emit ? 1 : -1;

        DG.Tweening.LoopType       dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart;
        Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart;
        LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp;
        GoLoopType    goLoopType   = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning;

        iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop;
        // Create tweens
        switch (testType)
        {
        case TestType.Floats:
            for (int i = 0; i < numTweens; ++i)
            {
                TestObjectData data = testObjsData[i];
                switch (engine)
                {
                case Engine.HOTween:
                    HOTween.To(data, duration, new Holoville.HOTween.TweenParms()
                               .Prop("floatValue", rndFloats[i])
                               .Ease(hotweenEase)
                               .Loops(loops, hotweenLoopType)
                               );
                    break;

                case Engine.LeanTween:
                    LeanTween.value(this.gameObject, x => data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                    break;

                case Engine.GoKit:
                    Go.to(data, duration, new GoTweenConfig()
                          .floatProp("floatValueProperty", rndFloats[i])
                          .setEaseType(goEase)
                          .setIterations(loops, goLoopType)
                          );
                    break;

                case Engine.iTween:
                    Hashtable hs = new Hashtable();
                    hs.Add("from", data.floatValue);
                    hs.Add("to", rndFloats[i]);
                    hs.Add("time", duration);
                    hs.Add("onupdate", "UpdateiTweenFloat");
                    hs.Add("looptype", iTweenLoopType);
                    hs.Add("easetype", iTweenEase);
                    iTween.ValueTo(this.gameObject, hs);
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    TestObjectData dataCopy = data;
                    DOTween.To(() => dataCopy.floatValue, x => dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                    break;
                }
            }
            break;

        default:
            for (int i = 0; i < numTweens; ++i)
            {
                float      twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration;
                Transform  t          = testObjsTrans[i];
                GameObject go         = testObjsGos[i];         // Used by LeanTween and iTween
                switch (engine)
                {
                case Engine.HOTween:
                    Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms()
                                                      .Ease(hotweenEase)
                                                      .Loops(loops, hotweenLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        tp.Prop("position", toPos);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        tp.Prop("rotation", toRot);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        tp.Prop("localScale", rndScale);
                        if (testSetup == TestSetup.Emit)
                        {
                            tp.OnComplete(() => EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase));
                        }
                    }
                    HOTween.To(t, twDuration, tp);
                    break;

                case Engine.LeanTween:
                    LTDescr leanTween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase));
                        }
                    }
                    if (scaleTween)
                    {
                        leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            leanTween.setOnComplete(() => EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase));
                        }
                    }
                    break;

                case Engine.GoKit:
                    GoTweenConfig goConfig = new GoTweenConfig()
                                             .setEaseType(goEase)
                                             .setIterations(loops, goLoopType);
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        goConfig.addTweenProperty(new PositionTweenProperty(toPos));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitPositionFor(t, toPos, twDuration, goEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        goConfig.addTweenProperty(new RotationTweenProperty(toRot));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitRotationFor(t, toRot, twDuration, goEase));
                        }
                    }
                    if (scaleTween)
                    {
                        goConfig.addTweenProperty(new ScaleTweenProperty(rndScale));
                        if (testSetup == TestSetup.Emit)
                        {
                            goConfig.onComplete(x => EmitGoKitScaleFor(t, rndScale, twDuration, goEase));
                        }
                    }
                    Go.to(t, twDuration, goConfig);
                    break;

                case Engine.iTween:
                    Hashtable hs;
                    if (positionTween)
                    {
                        hs = new Hashtable();
                        hs.Add("position", rndPositions[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.MoveTo(go, hs);
                    }
                    if (rotationTween)
                    {
                        hs = new Hashtable();
                        hs.Add("rotation", rndRotations[i]);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.RotateTo(go, hs);
                    }
                    if (scaleTween)
                    {
                        hs = new Hashtable();
                        hs.Add("scale", rndScale);
                        hs.Add("time", twDuration);
                        hs.Add("looptype", iTweenLoopType);
                        hs.Add("easetype", iTweenEase);
                        iTween.ScaleTo(go, hs);
                    }
                    break;

                default:
                    // tCopy is needed to create correct closure object,
                    // otherwise closure will pass the same t to all the loop
                    Transform         tCopy = t;
                    DG.Tweening.Tween dotween;
                    if (positionTween)
                    {
                        Vector3 toPos = rndPositions[i];
                        dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase));
                        }
                    }
                    if (rotationTween)
                    {
                        Vector3 toRot = rndRotations[i];
                        dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase));
                        }
                    }
                    if (scaleTween)
                    {
                        dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType);
                        if (testSetup == TestSetup.Emit)
                        {
                            dotween.OnComplete(() => EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase));
                        }
                    }
                    break;
                }
            }
            break;
        }
    }
示例#37
0
    /// <summary>
    /// Creates a tween based on the given tweenData and returns it,
    /// or returns <code>null</code> if the tween was empty.
    /// </summary>
    /// <param name="p_twData">
    /// A <see cref="HOTweenData"/>
    /// </param>
    public static Holoville.HOTween.Tweener CreateTween(HOTweenData p_twData, float p_globalDelay, float p_globalTimeScale)
    {
        if (p_twData.propDatas.Count == 0 || !p_twData.isActive) return null;

        TweenParms parms = new TweenParms()
            .Delay(p_twData.delay + p_globalDelay)
            .Id(p_twData.id)
            .Loops(p_twData.loops, p_twData.loopType)
            .UpdateType(p_twData.updateType)
            .Ease(p_twData.easeType)
            .TimeScale(p_twData.timeScale * p_globalTimeScale)
            .AutoKill(p_twData.autoKill)
            .Pause(p_twData.paused);

        // Eventual onComplete
        if (p_twData.onCompleteActionType != HOTweenData.OnCompleteActionType.None) {
            switch (p_twData.onCompleteActionType) {
                case HOTweenData.OnCompleteActionType.PlayAll:
                    parms.OnComplete(() => HOTween.Play());
                    break;
                case HOTweenData.OnCompleteActionType.PlayTweensById:
                    parms.OnComplete(() => HOTween.Play(p_twData.onCompletePlayId));
                    break;
                case HOTweenData.OnCompleteActionType.SendMessage:
                    if (p_twData.onCompleteTarget == null || p_twData.onCompleteMethodName == "") break;
                    object onCompleteParm = null;
                    switch (p_twData.onCompleteParmType) {
                        case HOTweenData.ParameterType.Color:
                            onCompleteParm = p_twData.onCompleteParmColor;
                            break;
                        case HOTweenData.ParameterType.Number:
                            onCompleteParm = p_twData.onCompleteParmNumber;
                            break;
                        case HOTweenData.ParameterType.Object:
                            onCompleteParm = p_twData.onCompleteParmObject;
                            break;
                        case HOTweenData.ParameterType.Quaternion:
                            onCompleteParm = p_twData.onCompleteParmQuaternion;
                            break;
                        case HOTweenData.ParameterType.Rect:
                            onCompleteParm = p_twData.onCompleteParmRect;
                            break;
                        case HOTweenData.ParameterType.String:
                            onCompleteParm = p_twData.onCompleteParmString;
                            break;
                        case HOTweenData.ParameterType.Vector2:
                            onCompleteParm = p_twData.onCompleteParmVector2;
                            break;
                        case HOTweenData.ParameterType.Vector3:
                            onCompleteParm = p_twData.onCompleteParmVector3;
                            break;
                        case HOTweenData.ParameterType.Vector4:
                            onCompleteParm = p_twData.onCompleteParmVector4;
                            break;
                    }
                    parms.OnComplete(p_twData.onCompleteTarget, p_twData.onCompleteMethodName, onCompleteParm);
                    break;
            }
        }

        foreach (HOPropData propData in p_twData.propDatas) {
            if (propData.isActive) {
                parms.Prop(propData.propName, Activator.CreateInstance(propData.pluginType, propData.endVal, propData.isRelative));
            }
        }
        if (!parms.hasProps) return null;

        if (p_twData.tweenFrom) return HOTween.From(p_twData.target, p_twData.duration, parms);
        return HOTween.To(p_twData.target, p_twData.duration, parms);
    }
示例#38
0
文件: U9T.cs 项目: bigstupidx/swip3
 /// <summary>
 /// Shorthand for the <see cref="U9HOTweenTransition"/>.
 /// Uses the default constructor. For more control, use the other overloads directly.
 /// </summary>
 /// <param name='hoTweenMethod'>
 /// HOTween method.
 /// </param>
 /// <param name='target'>
 /// Target.
 /// </param>
 /// <param name='duration'>
 /// Duration.
 /// </param>
 /// <param name='parms'>
 /// Parameters.
 /// </param>
 public static U9HOTweenTransition HOT(U9HOTweenTransition.HOTweenDelegate hoTweenMethod, object target, float duration, Holoville.HOTween.TweenParms parms)
 {
     return(new U9HOTweenTransition(hoTweenMethod, target, duration, parms));
 }
示例#39
0
	public static void Start(SampleClass[] cs, float[] to)
	{
		Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms().Ease(EaseType.EaseInOutQuad).Loops(-1, Holoville.HOTween.LoopType.Yoyo);
		for (int i = 0; i < cs.Length; ++i) {
			HOTween.To(cs[i], 1, tp.NewProp("floatVal", to[i]));
		}
	}