Time-based difficulty scaling with object pools and bird pooper restart improvements to the minigame

This commit is contained in:
Michal Pikulski
2025-12-16 23:21:10 +01:00
parent 0ff3fbbc70
commit 6133caec53
14 changed files with 994 additions and 280 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Pixelplacement;
using Pixelplacement.TweenSystem;
using UnityEngine;
@@ -145,6 +145,52 @@ namespace Utils
return Tween.CanvasGroupAlpha(canvasGroup, targetAlpha, duration, 0f, Tween.EaseInOut, completeCallback: onComplete);
}
/// <summary>
/// Fade Image alpha
/// </summary>
public static TweenBase FadeImageAlpha(UnityEngine.UI.Image image, float targetAlpha, float duration, Action onComplete = null)
{
return Tween.Value(image.color.a, targetAlpha, (alpha) =>
{
if (image != null)
{
Color color = image.color;
color.a = alpha;
image.color = color;
}
}, duration, 0f, Tween.EaseInOut, completeCallback: onComplete);
}
/// <summary>
/// Start blinking animation on Image (ping-pong alpha fade)
/// </summary>
/// <param name="image">Image to blink</param>
/// <param name="minAlpha">Minimum alpha value</param>
/// <param name="maxAlpha">Maximum alpha value</param>
/// <param name="duration">Duration for one complete cycle (in and out)</param>
/// <returns>TweenBase that can be cancelled</returns>
public static TweenBase StartBlinkImage(UnityEngine.UI.Image image, float minAlpha = 0.3f, float maxAlpha = 1f, float duration = 1.5f)
{
// Set initial alpha to max
if (image != null)
{
Color color = image.color;
color.a = maxAlpha;
image.color = color;
}
// Create ping-pong tween (half duration for each direction)
return Tween.Value(maxAlpha, minAlpha, (alpha) =>
{
if (image != null)
{
Color color = image.color;
color.a = alpha;
image.color = color;
}
}, duration / 2f, 0f, Tween.EaseInOut, Tween.LoopType.PingPong);
}
/// <summary>
/// Pop-out with fade - scale to 0 and fade out simultaneously
/// </summary>