2025-02-21 15:30:14 +08:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2025-05-01 22:54:56 +08:00
|
|
|
using DG.Tweening.Core.Easing;
|
|
|
|
|
using Ichni;
|
2025-02-21 15:30:14 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public static class WindowAnim
|
|
|
|
|
{
|
|
|
|
|
|
2025-05-01 22:54:56 +08:00
|
|
|
public static IEnumerator Shake(GameObject gameObject)
|
|
|
|
|
{
|
|
|
|
|
float timer = 0f;
|
|
|
|
|
Vector3 origpos = gameObject.transform.position;
|
|
|
|
|
while (timer <= 1f)
|
|
|
|
|
{
|
|
|
|
|
float offset = 50 * AnimationCurveEvaluator.Evaluate(AnimationCurveType.OutElastic, timer / 1f);
|
|
|
|
|
gameObject.transform.position = origpos + new Vector3(Random.Range(-offset, offset), Random.Range(-offset, offset), 0);
|
|
|
|
|
timer += Time.deltaTime;
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
gameObject.transform.position = origpos;
|
|
|
|
|
}
|
2025-02-28 20:08:00 +08:00
|
|
|
|
2025-02-21 15:30:14 +08:00
|
|
|
}
|