game over UI done, rematch left

This commit is contained in:
2026-05-03 01:07:17 +05:30
parent e3aa51d3e7
commit fb0d386ba1
19 changed files with 9476 additions and 1414 deletions
+23
View File
@@ -0,0 +1,23 @@
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
using TMPro;
[RequireComponent(typeof(TMP_Text))]
public class TextBlinker : MonoBehaviour
{
public float duration = 0.5f;
public Ease ease = Ease.InOutSine;
public float from = 0f;
public float to = 1f;
public int loops = -1;
public LoopType loopType = LoopType.Yoyo;
void Start()
{
var txt = GetComponent<TMP_Text>();
var c = txt.color;
c.a = from;
txt.color = c;
txt.DOFade(to, duration).SetEase(ease).SetLoops(loops, loopType);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 430ada29524e05f41b887541b79adc2c
+30
View File
@@ -0,0 +1,30 @@
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TMP_Text))]
public class TextColorFlash : MonoBehaviour
{
public Color colorA = Color.white;
public Color colorB = Color.red;
public float duration = 1f;
float a =0;
public float t;
TMP_Text txt;
void Start()
{
txt = GetComponent<TMP_Text>();
}
void Update()
{
if(duration <= 0){return;}
float sinA = Mathf.Sin(a);
t = sinA * 0.5f + 0.5f;
Color color = Color.Lerp(colorA, colorB, t);
txt.color = color;
a += Time.deltaTime * duration;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0d2075bb87ea2e44ebc4a00fcdac4ff2
+44
View File
@@ -0,0 +1,44 @@
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class ToggleButton : MonoBehaviour
{
[SerializeField]
public ToggleSpriteData[] toggleSpriteData;
public bool isOn = false;
Button btn;
public UnityEvent<bool> onToggleValueChanged = new UnityEvent<bool>();
void Start()
{
btn = GetComponent<Button>();
btn.onClick.AddListener(OnClick);
}
void OnClick()
{
SetIsOn(!isOn);
}
public void SetIsOn(bool isOn)
{
this.isOn = isOn;
foreach (var spriteData in toggleSpriteData)
{
spriteData.target.sprite = isOn ? spriteData.onSprite : spriteData.offSprite;
}
onToggleValueChanged.Invoke(isOn);
}
}
[Serializable]
public class ToggleSpriteData{
public Image target;
public Sprite onSprite;
public Sprite offSprite;
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 32dd41e420d0032409b03beba9058456