#pragma warning disable 0649
using System.Collections;
using UnityEngine;
namespace Watermelon
{
///
/// that bootstraps the Tween system during game initialisation.
/// Registered as a core module (order 800) — it runs early so that every subsequent module
/// can safely create tweens in its own init coroutine.
///
/// Configuration (set in the Inspector via the Project Init Settings asset):
///
/// - tweensUpdateCount — initial capacity of the tween array (default 300).
/// - tweensFixedUpdateCount — initial capacity of the array (default 30).
/// - tweensLateUpdateCount — initial capacity of the array (default 0).
/// - customEasingFunctions — project-specific -based easing presets registered with .
///
/// Tune capacities to the expected peak tween count to avoid mid-game array reallocations.
///
///
[RegisterModule("Tween", core: true, order: 800)]
public class TweenInitModule : InitModule
{
public override string ModuleName => "Tween";
[SerializeField] CustomEasingFunction[] customEasingFunctions;
[Space]
[SerializeField] int tweensUpdateCount = 300;
[SerializeField] int tweensFixedUpdateCount = 30;
[SerializeField] int tweensLateUpdateCount = 0;
///
/// Adds the MonoBehaviour to the initialiser's GameObject,
/// calls with the configured capacities, and registers any custom easing functions.
///
public override IEnumerator InitAsync(GameObject owner)
{
Tween tween = owner.AddComponent();
tween.Init(tweensUpdateCount, tweensFixedUpdateCount, tweensLateUpdateCount);
Ease.Init(customEasingFunctions);
yield break;
}
}
}