rhys-vdw / peachy-tween

A tweening library for Unity designed to be simple to use and extend.
https://peachy-tween.rhys.computer/
MIT License
7 stars 1 forks source link

Ability to manually update multiple tweens at once by ID #66

Open rhys-vdw opened 2 years ago

rhys-vdw commented 2 years ago

Generally a way to do this:

Peachy.ManualUpdate(new [] { tweenA, tweenB }, 0.5f);

But also need some way to Sync after bulk operations:

Peachy.KillTargeting(transform).Sync();
rhys-vdw commented 2 years ago

Thought on Sync:

Peachy.Targeting(transform).Kill().Sync();

Where Targeting returns a TweenTarget struct that has extension methods.

Or alternatively, maybe could do something simpler:

Peachy.KillTarget(transform);
Peachy.SyncTarget(transform);
Peachy.ManualUpdateTarget(transform, 0.5f);

Query thoughts

Could generally have structs that represent an enumerable collection of tweens (either a "query" or a list of Tweens), and these could be used for bulk operations that aren't tied to specific update groups.

So:

Tweens as = Peachy.Tweens(a, b, c);
Tweens bs = Peachy.Targeting(transform);
static Tweens KillTargeting(object target) {
  Tweens tweenss = Targeting(target);
  foreach (var tween in tweens) {
    Kill(t);
  }
  return tweens;
}

// Or more simply:

static Tweens Kill(Tweens tweens) {
  foreach (var t in tweens) Kill(t);
  return tweens;
}

static Tweens Sync(Tweens tweens) {
  _runState.Set(tweens);
  Run();
  return;
}

Peachy.Targeting(transform).Kill().Sync();