• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Tween类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Tween的典型用法代码示例。如果您正苦于以下问题:C# Tween类的具体用法?C# Tween怎么用?C# Tween使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tween类属于命名空间,在下文中一共展示了Tween类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: StartAttack

 public void StartAttack()
 {
     soldierState = SoldierState.ATTACKING;
     agent.enabled = false;
     swordTween = sword.transform.DOLocalRotate (new Vector3 (0, -83, -20), 0.2f).SetLoops (-1, LoopType.Yoyo);
     StartCoroutine (AttackJump ());
 }
开发者ID:JoeProgram,项目名称:monster,代码行数:7,代码来源:Soldier.cs


示例2: Start

    void Start()
    {
        // create a TweenConfig that we will use on all 4 cubes
        var config = new TweenConfig()
            .setEaseType( EaseType.QuadIn ) // set the ease type for the tweens
            .materialColor( Color.magenta ) // tween the material color to magenta
            .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation
            .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location
            .setIterations( 2, LoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back

        // create the chain and set it to have 2 iterations
        var chain = new TweenChain().setIterations( 2 );

        // add a completion handler for the chain
        chain.setOnCompleteHandler( c => Debug.Log( "chain complete" ) );

        // create a Tween for each cube and it to the chain
        foreach( var cube in cubes )
        {
            var tween = new Tween( cube, 0.5f, config );
            chain.append( tween );
        }

        _tween = chain;
    }
开发者ID:nbolabs,项目名称:GoKit,代码行数:25,代码来源:TweenChainGUI.cs


示例3: Start

    void Start()
    {
        // create a TweenConfig that we will use on all 4 cubes
        var config = new TweenConfig()
            .setEaseType( EaseType.QuadIn ) // set the ease type for the tweens
            .materialColor( Color.magenta ) // tween the material color to magenta
            .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation
            .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location
            .setIterations( 2, LoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back;

        // create the flow and set it to have 2 iterations
        var flow = new TweenFlow().setIterations( 2 );

        // add a completion handler for the chain
        flow.setOnCompleteHandler( c => Debug.Log( "flow complete" ) );

        // create a Tween for each cube and it to the flow
        var startTime = 0f;
        foreach( var cube in cubes )
        {
            var tween = new Tween( cube, 0.5f, config );
            flow.insert( startTime, tween );

            // increment our startTime so that the next tween starts when this one is halfway done
            startTime += 0.25f;
        }

        _tween = flow;
    }
开发者ID:nbolabs,项目名称:GoKit,代码行数:29,代码来源:TweenFlowGUI.cs


示例4: AddTween

 public Tween AddTween(IComponent target, Func<float, float> ease, int tweenType, float duration)
 {
     Tween tween = new Tween();
     tween.Setup(target, CreateAccessor(target), ease, tweenType, duration);
     tweens.Add(tween);
     return tween;
 }
开发者ID:kicholen,项目名称:SpaceShooter,代码行数:7,代码来源:TweenComponent.cs


示例5: AddHeart

    public void AddHeart()
    {
        FSprite heart = new FSprite("heart.psd");
        heart.x = Random.Range(heart.width / 2f, Futile.screen.width - heart.width / 2f);
        heart.y = Random.Range(heart.height / 2f, Futile.screen.height - heart.height / 2f - 50f /*UI bar*/);
        heart.scale = 0;
        heart.rotation = Random.Range(0, 359f);
        heart.color = new Color(1.0f, Random.Range(0.0f, 0.3f), Random.Range(0.0f, 0.3f), 1.0f);
        AddChild(heart);
        hearts.Add(heart);

        Go.to(heart, Random.Range(1.0f, 5.0f), new TweenConfig()
            .setIterations(-1)
            .floatProp("rotation", 360 * (RXRandom.Float() < 0.5f ? 1 : -1), true));

        float inflationDuration = Random.Range(1.0f, 2.0f);
        Tween tweenUp = new Tween(heart, inflationDuration, new TweenConfig()
            .floatProp("scale", Random.Range(0.3f, 1.0f))
            .setEaseType(EaseType.SineInOut));

        Tween tweenDown = new Tween(heart, inflationDuration, new TweenConfig()
            .floatProp("scale", 0)
            .onComplete(OnHeartDisappearedWithoutBeingTouched)
            .setEaseType(EaseType.SineInOut));

        TweenChain chain = new TweenChain();
        chain.append(tweenUp);
        chain.append(tweenDown);

        Go.addTween(chain);
        chain.play();
    }
开发者ID:wtrebella,项目名称:First-Year-Anniversary-Game,代码行数:32,代码来源:TClickHeartsScene.cs


示例6: Execute

 public override void Execute()
 {
     var tweener = EntityView.transform.DORotate(DestinationRotation, Duration, RotateMode);
     tweener.Pause();
     
     CreatedTween = tweener;
 }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:7,代码来源:CreateRotationTween.cs


示例7: Execute

        public override void Execute()
        {
            var tweener = EntityView.transform.DOLookAt(LookAt, Duration, AxisConstraint);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:7,代码来源:CreateLookAtTween.cs


示例8: Execute

        public override void Execute()
        {
            var tweener = EntityView.transform.DOPunchPosition(PunchVector, Duration, Vibration, Elasticity, UseSnapping);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:7,代码来源:CreatePunchPositionTween.cs


示例9: Execute

        public override void Execute()
        {
            var tweener = Material.DOColor(NewColour, PropertyName, Duration);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:7,代码来源:CreateColourPropertyTween.cs


示例10: RunTween

    private bool RunTween(Tween tween)
    {
        var t = tween.TargetObj.Clock.CurrTime - tween.StartTime;

        if (t < tween.Delay)
            return false;

        if (!tween.Started)
        {
            tween.Started = true;
            tween.__SetStartVal();
            if (tween.StartCallback != null)
                tween.StartCallback(tween.TargetObj);
        }

        if (t >= tween.Duration + tween.Delay)
        {
            tween.Complete = true;
            tween.Property.SetValue(tween.TargetObj, tween.EndVal, null);

            if (tween.EndCallback != null)
                tween.EndCallback(tween.TargetObj);

            if (tween.ChainedTween != null)
            {
                __AddTween(tween.ChainedTween);
            }

            return true;
        }

        var val = tween.EasingType(t - tween.Delay, tween.StartVal, tween.EndVal - tween.StartVal, tween.Duration);
        tween.Property.SetValue(tween.TargetObj, val, null);
        return false;
    }
开发者ID:kyallbarrows,项目名称:Cinch_4-3,代码行数:35,代码来源:TweenRunner.cs


示例11: Play

	public void Play() {
		if (_tween != null) {
			_tween.Destroy();
			_tween = null;
		}
		
		_looping = true;
		
		Vector3 theStartPos = _startPosition;	
		Vector3 theEndPos =_startPosition + BounceOffset;
			
		if (_reverse) {
			theStartPos = _startPosition + BounceOffset;
			theEndPos = _startPosition;
		}
		
		//LOOP YOYO:
		_tween = Tween.to(theStartPos, theEndPos, LoopDuration, EaseType, 
			(Tween t) => { transform.localPosition = (Vector3) t.Value;},
			null,
			0f,
			Yoyo,
			LoopCount
		);
		
		if (RandomStartProgress) {
			_tween.SetProgress(Random.Range(0f, 1f));
		}
	}
开发者ID:runevision,项目名称:vrplatforms,代码行数:29,代码来源:Bouncer.cs


示例12: Awake

        void Awake()
        {
            tween = GetComponent<Tween>();
            tween.autoPlay = false;

            machine = new StateMachine<GateFSM>(this);
        }
开发者ID:wirunekaewjai-education-projects,项目名称:unity-fsm,代码行数:7,代码来源:GateFSM.cs


示例13: Execute

        public override void Execute()
        {
            var tweener = EntityView.transform.DOMove(Destination, Duration, UseSnapping);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:7,代码来源:CreateMovementToPositionTween.cs


示例14: DoInsert

        internal static Sequence DoInsert(Sequence inSequence, Tween t, float atPosition)
        {
            TweenManager.AddActiveTweenToSequence(t);

            // If t has a delay add it as an interval
            atPosition += t.delay;
            inSequence.lastTweenInsertTime = atPosition;

            t.isSequenced = t.creationLocked = true;
            t.sequenceParent = inSequence;
            if (t.loops == -1) t.loops = 1;
            float tFullTime = t.duration * t.loops;
            t.autoKill = false;
            t.delay = t.elapsedDelay = 0;
            t.delayComplete = true;
            t.isSpeedBased = false;
            t.sequencedPosition = atPosition;
            t.sequencedEndPosition = atPosition + tFullTime;

            if (t.sequencedEndPosition > inSequence.duration) inSequence.duration = t.sequencedEndPosition;
            inSequence._sequencedObjs.Add(t);
            inSequence.sequencedTweens.Add(t);

            return inSequence;
        }
开发者ID:amirebrahimi,项目名称:dotween,代码行数:25,代码来源:Sequence.cs


示例15: Awake

        void Awake()
        {
            tween = GetComponent<Tween>();
            tween.autoPlay = false;

            fsm = new Fsm(this);
        }
开发者ID:wirunekaewjai-education-projects,项目名称:unity-5-platformer-2d,代码行数:7,代码来源:GateFSM.cs


示例16: shake

 public void shake()
 {
     if (shakeTween == null || !shakeTween.IsPlaying())
     {
         shakeTween = transform.DOShakePosition(duration, strength, vibrado, randomness);
     }       
 }
开发者ID:interwebsninja,项目名称:gravefighter,代码行数:7,代码来源:cameraReact.cs


示例17: LevelEnded

    public void LevelEnded()
    {
        currentLevel++;

        PauseAllCircles();

        gameManager.gameState = GameState.Transitioning;

        ExecuteDelayedAction(1.0f, () =>
            {
                if (currentLevel == levels.Length)
                {
                    gameManager.gameState = GameState.Ended;

                    TweenFlow fadeOutFlow = new TweenFlow();

                    foreach (GameObject circle in GameObject.FindGameObjectsWithTag("Circle"))
                    {
                        Tween fadeOutTween = new Tween(circle.transform, transitionHalfTime, new TweenConfig().scale(0).setEaseType(EaseType.Linear));
                        fadeOutFlow.insert(0, fadeOutTween);
                    }

                    fadeOutFlow.setOnCompleteHandler((a) =>
                    {
                        ClearLevel();

                        TweenFlow fadeInFlow = new TweenFlow();

                        gameFinishedObject.SetActive(true);
                        Vector3 origScale = gameFinishedObject.transform.localScale;

                        gameFinishedObject.transform.localScale = Vector3.zero;

                        Tween fadeInTween = new Tween(gameFinishedObject.transform, transitionHalfTime, new TweenConfig().scale(origScale).setEaseType(EaseType.QuadIn));

                        fadeInFlow.insert(0, fadeInTween);

                        fadeInFlow.setOnCompleteHandler((aaa) =>
                        {
                            ExecuteDelayedAction(2.0f, () =>
                            {
                                GameObject.Find("PageManager").GetComponent<PageManager>().GoToPage(GamePage.MainMenu);
                            });
                        });

                        fadeInFlow.play();
                    }
                    );

                    gameManager.gameState = GameState.Transitioning;
                    fadeOutFlow.play();
                }
                else
                {
                    SwitchToLevel(currentLevel);
                }
            }
        );
    }
开发者ID:sergilazaro,项目名称:rewind,代码行数:59,代码来源:LevelManager.cs


示例18: Execute

        public override void Execute()
        {
            var light = EntityView.GetComponent<Light>();
            var tweener = light.DOShadowStrength(ShadowStrength, Duration);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:8,代码来源:CreateShadowStrengthTween.cs


示例19: Execute

        public override void Execute()
        {
            var renderer = EntityView.GetComponent<Renderer>();
            var tweener = renderer.material.DOVector(Value, PropertyName, Duration);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:8,代码来源:CreateMaterialVectorTween.cs


示例20: Execute

        public override void Execute()
        {
            var light = EntityView.GetComponent<Light>();
            var tweener = light.DOColor(NewColour, Duration);
            tweener.Pause();

            CreatedTween = tweener;
        }
开发者ID:grofit,项目名称:uFrame.ECS.Actions.DoTween,代码行数:8,代码来源:CreateColourTween.cs



注:本文中的Tween类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TweenAction类代码示例发布时间:2022-05-24
下一篇:
C# Turn类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap