修了很多bug和增加功能,优化不少问题

This commit is contained in:
2026-02-28 06:59:22 +08:00
parent 508a40bba0
commit e11cc1da7a
345 changed files with 173803 additions and 69332 deletions
+49 -4
View File
@@ -16,6 +16,17 @@ public class load_enemyBall_light : MonoBehaviour
public Color symbol_elite_color = Color.blue;
public Color symbol_boss_color = Color.red;
public Color symbol_legendary_color = Color.yellow;
public Color symbol_guardian_color = Color.red;
[Header("ball sprites")]
public Sprite symbol_default_sprite;
public Sprite symbol_dead_sprite;
public Sprite symbol_simple_sprite;
public Sprite symbol_elite_sprite;
public Sprite symbol_boss_sprite;
public Sprite symbol_legendary_sprite;
public Sprite symbol_guardian_sprite;
private List<global::enemyBallLightPrefab> instantiatedBalls = new List<global::enemyBallLightPrefab>();
private int currentEnemyIndex = 0;
@@ -47,10 +58,21 @@ public class load_enemyBall_light : MonoBehaviour
if (ballScript != null)
{
// Set color based on enemy type
// Set sprite based on enemy type (changed from applying color to applying sprite)
if (ballScript.ballImage_img != null)
{
ballScript.ballImage_img.color = GetColorForEnemyType(enemyType);
Sprite s = GetSpriteForEnemyType(enemyType);
if (s != null)
{
ballScript.ballImage_img.sprite = s;
// ensure image has default color so sprite displays normally
ballScript.ballImage_img.color = Color.white;
}
else
{
// fallback: keep existing sprite but ensure default color
ballScript.ballImage_img.color = symbol_default_color;
}
}
// Initial cursor state: only first one active
@@ -72,10 +94,19 @@ public class load_enemyBall_light : MonoBehaviour
// Ensure index is within bounds
if (currentEnemyIndex >= instantiatedBalls.Count) return;
// Change the current enemy's ball color to dead color
// Change the current enemy's ball to dead sprite
if (instantiatedBalls[currentEnemyIndex].ballImage_img != null)
{
instantiatedBalls[currentEnemyIndex].ballImage_img.color = symbol_dead_color;
if (symbol_dead_sprite != null)
{
instantiatedBalls[currentEnemyIndex].ballImage_img.sprite = symbol_dead_sprite;
instantiatedBalls[currentEnemyIndex].ballImage_img.color = Color.white;
}
else
{
// fallback to setting color if dead sprite not assigned
instantiatedBalls[currentEnemyIndex].ballImage_img.color = symbol_dead_color;
}
}
// Turn off cursor for current (defeated) enemy
@@ -112,7 +143,21 @@ public class load_enemyBall_light : MonoBehaviour
case EnemyData_SO.EnemyType.Elite: return symbol_elite_color;
case EnemyData_SO.EnemyType.Boss: return symbol_boss_color;
case EnemyData_SO.EnemyType.Legend: return symbol_legendary_color;
case EnemyData_SO.EnemyType.Guardian: return symbol_guardian_color;
default: return symbol_default_color;
}
}
private Sprite GetSpriteForEnemyType(EnemyData_SO.EnemyType enemyType)
{
switch (enemyType)
{
case EnemyData_SO.EnemyType.Simple: return symbol_simple_sprite;
case EnemyData_SO.EnemyType.Elite: return symbol_elite_sprite;
case EnemyData_SO.EnemyType.Boss: return symbol_boss_sprite;
case EnemyData_SO.EnemyType.Legend: return symbol_legendary_sprite;
case EnemyData_SO.EnemyType.Guardian: return symbol_guardian_sprite;
default: return symbol_default_sprite;
}
}
}