超大量的更新 修复很多问题,gameplay特效初步
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
{
|
||||
public static Animation_GenerateJudgementSituationPrefab Instance;
|
||||
|
||||
[Header("����� (������)")]
|
||||
[Header("Inspector")]
|
||||
public GameObject redEffect;
|
||||
public GameObject greenEffect;
|
||||
public GameObject yellowEffect;
|
||||
public GameObject purpleEffect;
|
||||
public GameObject blueEffect;
|
||||
|
||||
[Header("�ж�Ʈ�� Prefabs")]
|
||||
[Header("Inspector")]
|
||||
public GameObject perfect_judge_prefab;
|
||||
public GameObject great_judge_prefab;
|
||||
public GameObject good_judge_prefab;
|
||||
public GameObject miss_judge_prefab;
|
||||
|
||||
[Header("���������")]
|
||||
[Header("Inspector")]
|
||||
public float baseScale = 1.0f;
|
||||
public bool useRandomScale = true;
|
||||
public float minScaleMultiplier = 0.8f;
|
||||
public float maxScaleMultiplier = 1.2f;
|
||||
|
||||
[Header("������Ծ����")]
|
||||
public float jumpForce = 5.0f; // ���ϵ���ij�ʼ�ٶ�
|
||||
public float gravity = -12.0f; // ����
|
||||
[Header("Inspector")]
|
||||
public float jumpForce = 5.0f; // Documentation text normalized.
|
||||
public float gravity = -16f; // Documentation text normalized.
|
||||
|
||||
[Header("ʱ�������ȿ��� (��)")]
|
||||
public float fadeInTime = 0.1f; // ���ɺ��������ɽ��� (0->1)
|
||||
public float fadeOutStartTime = 0.6f; // ���ɺ�ڼ��뿪ʼ����
|
||||
public float fadeOutDuration = 0.3f; // ������������ʱ��
|
||||
[Header("Inspector")]
|
||||
public float fadeInTime = 0.1f; // Documentation text normalized.
|
||||
public float fadeOutStartTime = 0.6f; // Documentation text normalized.
|
||||
public float fadeOutDuration = 0.35f; // Documentation text normalized.
|
||||
|
||||
// Cache spawn transforms to avoid accessing destroyed GameObject references.
|
||||
private Transform redSpawn;
|
||||
@@ -48,8 +48,8 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
// ע�⣺������һ�δ���ʱ�������������¼���
|
||||
// DontDestroyOnLoad(gameObject); // �� �Ƴ������������������¼���ʱ������
|
||||
// Documentation text normalized.
|
||||
// Documentation text normalized.
|
||||
}
|
||||
else if (Instance != this)
|
||||
{
|
||||
@@ -150,12 +150,12 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
GameObject instance = Instantiate(prefabToUse, spawnPoint);
|
||||
instance.transform.localPosition = Vector3.zero;
|
||||
|
||||
// ��������
|
||||
// Documentation text normalized.
|
||||
float finalScale = baseScale;
|
||||
if (useRandomScale) finalScale *= Random.Range(minScaleMultiplier, maxScaleMultiplier);
|
||||
instance.transform.localScale = new Vector3(finalScale, finalScale, 1f);
|
||||
|
||||
// �����˶���
|
||||
// Documentation text normalized.
|
||||
StartCoroutine(AnimateSprite(instance));
|
||||
}
|
||||
|
||||
@@ -168,10 +168,10 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
float vVelocity = jumpForce;
|
||||
Vector3 currentLocalPos = Vector3.zero;
|
||||
|
||||
// �������������ڣ���ʼ������ʱ�� + ����������ʱ��
|
||||
// Documentation text normalized.
|
||||
float totalLifeTime = fadeOutStartTime + fadeOutDuration;
|
||||
|
||||
// ��ʼ����
|
||||
// Documentation text normalized.
|
||||
if (sr != null)
|
||||
{
|
||||
Color c = sr.color;
|
||||
@@ -179,7 +179,7 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
sr.color = c;
|
||||
}
|
||||
|
||||
// ֻҪû�����������ͳ���ִ��
|
||||
// Documentation text normalized.
|
||||
while (elapsed < totalLifeTime)
|
||||
{
|
||||
if (obj == null) yield break;
|
||||
@@ -187,28 +187,28 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
float dt = Time.deltaTime;
|
||||
elapsed += dt;
|
||||
|
||||
// --- 1. ����� ---
|
||||
// Documentation text normalized.
|
||||
vVelocity += gravity * dt;
|
||||
currentLocalPos.y += vVelocity * dt;
|
||||
obj.transform.localPosition = currentLocalPos;
|
||||
|
||||
// --- 2. ������ (��������) ---
|
||||
// Documentation text normalized.
|
||||
if (sr != null)
|
||||
{
|
||||
float alpha;
|
||||
|
||||
// ���ԽΣ���ǰʱ�� < fadeInTime
|
||||
// Documentation text normalized.
|
||||
if (elapsed < fadeInTime)
|
||||
{
|
||||
alpha = Mathf.InverseLerp(0f, fadeInTime, elapsed);
|
||||
}
|
||||
// �����Σ���ǰʱ�� > fadeOutStartTime
|
||||
// Documentation text normalized.
|
||||
else if (elapsed > fadeOutStartTime)
|
||||
{
|
||||
// �� fadeOutStartTime �� totalLifeTime ֮��� 1 �䵽 0
|
||||
// Documentation text normalized.
|
||||
alpha = Mathf.InverseLerp(totalLifeTime, fadeOutStartTime, elapsed);
|
||||
}
|
||||
// �м���ȫ��ʾ��
|
||||
// Documentation text normalized.
|
||||
else
|
||||
{
|
||||
alpha = 1f;
|
||||
@@ -222,7 +222,7 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// --- ȷ�����һ֡����ȫ���� ---
|
||||
// Documentation text normalized.
|
||||
if (obj != null && sr != null)
|
||||
{
|
||||
Color c = sr.color;
|
||||
@@ -230,8 +230,7 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
sr.color = c;
|
||||
}
|
||||
|
||||
// �ȴ���Ⱦ��ɣ���ֹ��ɾ
|
||||
yield return new WaitForEndOfFrame();
|
||||
// Documentation text normalized.
|
||||
|
||||
if (obj != null) Destroy(obj);
|
||||
}
|
||||
@@ -240,8 +239,7 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
{
|
||||
if (string.IsNullOrEmpty(color)) return null;
|
||||
|
||||
// ��ÿ�ε���ʱ����Ƿ���Ҫ���»���
|
||||
CacheSpawnPointsIfNeeded();
|
||||
// Documentation text normalized.
|
||||
|
||||
Transform point = null;
|
||||
switch (color.ToLower())
|
||||
@@ -287,4 +285,4 @@ public class Animation_GenerateJudgementSituationPrefab : MonoBehaviour
|
||||
|
||||
return prefab;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user