Files
SVSimServer/SVSim.BattleEngine/Engine/TweenRotation.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

94 lines
1.9 KiB
C#

using System;
using UnityEngine;
[AddComponentMenu("NGUI/Tween/Tween Rotation")]
public class TweenRotation : UITweener
{
public Vector3 from;
public Vector3 to;
public bool quaternionLerp;
private Transform mTrans;
public Transform cachedTransform
{
get
{
if (mTrans == null)
{
mTrans = base.transform;
}
return mTrans;
}
}
[Obsolete("Use 'value' instead")]
public Quaternion rotation
{
get
{
return value;
}
set
{
this.value = value;
}
}
public Quaternion value
{
get
{
return cachedTransform.localRotation;
}
set
{
cachedTransform.localRotation = value;
}
}
protected override void OnUpdate(float factor, bool isFinished)
{
value = (quaternionLerp ? Quaternion.Slerp(Quaternion.Euler(from), Quaternion.Euler(to), factor) : Quaternion.Euler(new Vector3(Mathf.Lerp(from.x, to.x, factor), Mathf.Lerp(from.y, to.y, factor), Mathf.Lerp(from.z, to.z, factor))));
}
public static TweenRotation Begin(GameObject go, float duration, Quaternion rot)
{
TweenRotation tweenRotation = UITweener.Begin<TweenRotation>(go, duration);
tweenRotation.from = tweenRotation.value.eulerAngles;
tweenRotation.to = rot.eulerAngles;
if (duration <= 0f)
{
tweenRotation.Sample(1f, isFinished: true);
tweenRotation.enabled = false;
}
return tweenRotation;
}
[ContextMenu("Set 'From' to current value")]
public override void SetStartToCurrentValue()
{
from = value.eulerAngles;
}
[ContextMenu("Set 'To' to current value")]
public override void SetEndToCurrentValue()
{
to = value.eulerAngles;
}
[ContextMenu("Assume value of 'From'")]
private void SetCurrentValueToStart()
{
value = Quaternion.Euler(from);
}
[ContextMenu("Assume value of 'To'")]
private void SetCurrentValueToEnd()
{
value = Quaternion.Euler(to);
}
}