本文整理汇总了C#中Tween类的典型用法代码示例。如果您正苦于以下问题:C# Tween类的具体用法?C# Tween怎么用?C# Tween使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tween类属于命名空间,在下文中一共展示了Tween类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ());
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例6: Execute
public override void Execute()
{
var tweener = EntityView.transform.DORotate(DestinationRotation, Duration, RotateMode);
tweener.Pause();
CreatedTween = tweener;
}
示例7: Execute
public override void Execute()
{
var tweener = EntityView.transform.DOLookAt(LookAt, Duration, AxisConstraint);
tweener.Pause();
CreatedTween = tweener;
}
示例8: Execute
public override void Execute()
{
var tweener = EntityView.transform.DOPunchPosition(PunchVector, Duration, Vibration, Elasticity, UseSnapping);
tweener.Pause();
CreatedTween = tweener;
}
示例9: Execute
public override void Execute()
{
var tweener = Material.DOColor(NewColour, PropertyName, Duration);
tweener.Pause();
CreatedTween = tweener;
}
示例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;
}
示例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));
}
}
示例12: Awake
void Awake()
{
tween = GetComponent<Tween>();
tween.autoPlay = false;
machine = new StateMachine<GateFSM>(this);
}
示例13: Execute
public override void Execute()
{
var tweener = EntityView.transform.DOMove(Destination, Duration, UseSnapping);
tweener.Pause();
CreatedTween = tweener;
}
示例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;
}
示例15: Awake
void Awake()
{
tween = GetComponent<Tween>();
tween.autoPlay = false;
fsm = new Fsm(this);
}