feat(battle-engine): copy-loop closure to 3282 files (member-surface frontier)

This commit is contained in:
gamer147
2026-06-05 20:41:25 -04:00
parent 3dcd53933a
commit f9982f5249
41 changed files with 3030 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class TweenPositionWithUpdate : TweenPosition
{
private Action<float> _onUpdate;
public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, Action<float> onUpdate)
{
TweenPositionWithUpdate tweenPositionWithUpdate = UITweener.Begin<TweenPositionWithUpdate>(go, duration);
tweenPositionWithUpdate.from = tweenPositionWithUpdate.value;
tweenPositionWithUpdate.to = pos;
if (duration <= 0f)
{
tweenPositionWithUpdate.Sample(1f, isFinished: true);
tweenPositionWithUpdate.enabled = false;
}
tweenPositionWithUpdate._onUpdate = onUpdate;
return tweenPositionWithUpdate;
}
public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, bool worldSpace, Action<float> onUpdate)
{
TweenPositionWithUpdate tweenPositionWithUpdate = UITweener.Begin<TweenPositionWithUpdate>(go, duration);
tweenPositionWithUpdate.worldSpace = worldSpace;
tweenPositionWithUpdate.from = tweenPositionWithUpdate.value;
tweenPositionWithUpdate.to = pos;
if (duration <= 0f)
{
tweenPositionWithUpdate.Sample(1f, isFinished: true);
tweenPositionWithUpdate.enabled = false;
}
tweenPositionWithUpdate._onUpdate = onUpdate;
return tweenPositionWithUpdate;
}
protected override void OnUpdate(float factor, bool isFinished)
{
base.value = from * (1f - factor) + to * factor;
_onUpdate.Call(factor);
}
}