implement major gameplay changes
This commit is contained in:
@@ -128,7 +128,9 @@ public class EnemyHealth : MonoBehaviour
|
||||
text.text = damage.ToString();
|
||||
text.fontSize = 3.1f;
|
||||
text.alignment = TextAlignmentOptions.Center;
|
||||
text.color = Color.white;
|
||||
text.color = GetDamageTakenMultiplier() > 1f
|
||||
? new Color(0.4f, 0.9f, 1f, 1f)
|
||||
: new Color(1f, 0.88f, 0.58f, 1f);
|
||||
text.sortingOrder = 50;
|
||||
textObject.AddComponent<FloatingWorldText>().Configure(0.75f, new Vector3(0f, 0.58f, 0f));
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ public class EnemySpawner : MonoBehaviour
|
||||
private bool isSpawning = false;
|
||||
private bool stageComplete = false;
|
||||
private int enemiesRemaining = 0;
|
||||
private int baseEnemyCount = 5;
|
||||
private int enemyCountIncrease = 3;
|
||||
private float enemySpeed = 1.16f;
|
||||
private int baseEnemyCount = 9;
|
||||
private int enemyCountIncrease = 5;
|
||||
private float enemySpeed = 1.05f;
|
||||
private int enemyBaseHP = 1;
|
||||
private float maxEnemySpeed = 6f;
|
||||
private int maxEnemyHP = 20;
|
||||
private float maxEnemySpeed = 5.2f;
|
||||
private int maxEnemyHP = 32;
|
||||
private RectTransform bossHealthBar;
|
||||
private Image bossHealthFill;
|
||||
private TextMeshProUGUI bossHealthText;
|
||||
@@ -60,7 +60,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
for (int i = 0; i < enemiesToSpawn; i++)
|
||||
{
|
||||
SpawnEnemy(false);
|
||||
yield return new WaitForSeconds(1f);
|
||||
yield return new WaitForSeconds(0.72f);
|
||||
}
|
||||
|
||||
if (IsBossWave(currentWave))
|
||||
@@ -79,8 +79,8 @@ public class EnemySpawner : MonoBehaviour
|
||||
Enemy enemyComponent = newEnemy.GetComponent<Enemy>();
|
||||
if (enemyComponent != null)
|
||||
{
|
||||
float waveSpeedBonus = currentWave * 0.028f;
|
||||
float stageSpeedBonus = (currentStage - 1) * 0.025f;
|
||||
float waveSpeedBonus = currentWave * 0.022f;
|
||||
float stageSpeedBonus = (currentStage - 1) * 0.018f;
|
||||
enemyComponent.speed = Mathf.Min(maxEnemySpeed, enemySpeed + waveSpeedBonus + stageSpeedBonus);
|
||||
if (boss)
|
||||
enemyComponent.speed *= 0.72f;
|
||||
@@ -89,9 +89,11 @@ public class EnemySpawner : MonoBehaviour
|
||||
EnemyHealth enemyHealth = newEnemy.GetComponent<EnemyHealth>();
|
||||
if (enemyHealth != null)
|
||||
{
|
||||
int scaledHP = enemyBaseHP + Mathf.FloorToInt(currentWave * 0.14f) + Mathf.FloorToInt((currentStage - 1) * 0.25f);
|
||||
int scaledHP = enemyBaseHP
|
||||
+ Mathf.RoundToInt((currentWave - 1) * 0.15f)
|
||||
+ Mathf.RoundToInt((currentStage - 1) * 0.45f);
|
||||
if (boss)
|
||||
scaledHP = Mathf.RoundToInt((scaledHP + currentStage + currentWave * 0.48f) * 3.05f);
|
||||
scaledHP = Mathf.RoundToInt((scaledHP + currentStage + currentWave * 0.4f) * 2.6f);
|
||||
scaledHP = Mathf.Min(boss ? maxEnemyHP * 4 : maxEnemyHP, scaledHP);
|
||||
enemyHealth.SetHealth(scaledHP);
|
||||
|
||||
@@ -131,7 +133,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
if (roll < fastChance)
|
||||
{
|
||||
enemyObject.name = "Fast Enemy";
|
||||
enemyComponent.speed *= 1.65f;
|
||||
enemyComponent.speed *= 1.55f;
|
||||
enemyObject.transform.localScale *= 0.82f;
|
||||
if (spriteRenderer != null)
|
||||
spriteRenderer.color = new Color(0.35f, 0.78f, 1f, 1f);
|
||||
@@ -141,7 +143,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
enemyObject.name = "Tank Enemy";
|
||||
enemyComponent.speed *= 0.62f;
|
||||
enemyObject.transform.localScale *= 1.32f;
|
||||
enemyHealth.SetHealth(Mathf.Max(2, Mathf.RoundToInt(enemyHealth.GetCurrentHealth() * 2.35f)));
|
||||
enemyHealth.SetHealth(Mathf.Max(2, Mathf.RoundToInt(enemyHealth.GetCurrentHealth() * 1.8f)));
|
||||
if (spriteRenderer != null)
|
||||
spriteRenderer.color = new Color(0.78f, 0.56f, 0.28f, 1f);
|
||||
}
|
||||
@@ -246,7 +248,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
if (bossHealthFill != null)
|
||||
{
|
||||
bossHealthFill.fillAmount = 1f;
|
||||
bossHealthFill.color = Color.Lerp(new Color(0.55f, 0.05f, 0.06f, 1f), new Color(0.95f, 0.2f, 0.18f, 1f), percent);
|
||||
bossHealthFill.color = Color.Lerp(new Color(0.48f, 0.035f, 0.055f, 1f), UITheme.Red, percent);
|
||||
RectTransform fillRect = bossHealthFill.rectTransform;
|
||||
fillRect.anchorMax = new Vector2(percent, fillRect.anchorMax.y);
|
||||
fillRect.offsetMax = Vector2.zero;
|
||||
@@ -284,10 +286,12 @@ public class EnemySpawner : MonoBehaviour
|
||||
rect.SetAsLastSibling();
|
||||
|
||||
Image background = overlay.GetComponent<Image>();
|
||||
background.color = new Color(0f, 0f, 0f, 0.78f);
|
||||
background.color = new Color(0.005f, 0.012f, 0.022f, 0.9f);
|
||||
background.raycastTarget = true;
|
||||
|
||||
TextMeshProUGUI title = CreateOverlayText("Title", rect, "YOU WIN", 46f, FontStyles.Bold);
|
||||
UITheme.AddAccent(rect, "VictoryLine", UITheme.Green, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-220f, 118f), new Vector2(220f, 121f));
|
||||
TextMeshProUGUI title = CreateOverlayText("Title", rect, "STAGE SECURED", 46f, FontStyles.Bold);
|
||||
title.color = UITheme.Green;
|
||||
PlaceOverlayRect(title.rectTransform, 0f, 76f, 420f, 70f);
|
||||
|
||||
TextMeshProUGUI subtitle = CreateOverlayText("Subtitle", rect, $"Stage {currentStage} complete. Stage {nextStage} unlocked.", 20f, FontStyles.Normal);
|
||||
@@ -296,7 +300,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
if (unlockedTeslaTower)
|
||||
{
|
||||
TextMeshProUGUI unlockText = CreateOverlayText("UnlockText", rect, "You unlocked: Tesla Tower", 22f, FontStyles.Bold);
|
||||
unlockText.color = new Color(0.52f, 0.86f, 1f, 1f);
|
||||
unlockText.color = UITheme.CyanBright;
|
||||
PlaceOverlayRect(unlockText.rectTransform, 0f, -14f, 520f, 42f);
|
||||
}
|
||||
|
||||
@@ -331,7 +335,8 @@ public class EnemySpawner : MonoBehaviour
|
||||
Image panel = bossHealthBar.GetComponent<Image>();
|
||||
if (panel == null)
|
||||
panel = bossHealthBar.gameObject.AddComponent<Image>();
|
||||
panel.color = new Color(0.05f, 0.03f, 0.035f, 0.88f);
|
||||
UITheme.StylePanel(panel, new Color(0.12f, 0.035f, 0.05f, 0.94f), new Color(0.9f, 0.18f, 0.22f, 0.9f));
|
||||
UITheme.AddTopAccent(bossHealthBar, UITheme.Red, 3f);
|
||||
|
||||
RectTransform track = bossHealthBar.Find("Track")?.GetComponent<RectTransform>();
|
||||
if (track == null)
|
||||
@@ -343,7 +348,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
track.anchoredPosition = new Vector2(0f, 8f);
|
||||
track.sizeDelta = new Vector2(-24f, 16f);
|
||||
Image trackImage = track.gameObject.AddComponent<Image>();
|
||||
trackImage.color = new Color(0.16f, 0.08f, 0.08f, 1f);
|
||||
trackImage.color = new Color(0.2f, 0.06f, 0.08f, 1f);
|
||||
}
|
||||
|
||||
bossHealthFill = track.Find("Fill")?.GetComponent<Image>();
|
||||
@@ -397,7 +402,8 @@ public class EnemySpawner : MonoBehaviour
|
||||
panel.sizeDelta = new Vector2(150f, 42f);
|
||||
|
||||
Image panelImage = panelObject.GetComponent<Image>();
|
||||
panelImage.color = new Color(0.05f, 0.06f, 0.08f, 0.84f);
|
||||
UITheme.StylePanel(panelImage, UITheme.Panel, UITheme.Border);
|
||||
UITheme.AddTopAccent(panel, UITheme.Cyan, 3f);
|
||||
|
||||
GameObject textObject = new GameObject("Text", typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI));
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
@@ -411,7 +417,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
waveText.alignment = TextAlignmentOptions.Center;
|
||||
waveText.fontSize = 21f;
|
||||
waveText.fontStyle = FontStyles.Bold;
|
||||
waveText.color = new Color(0.92f, 0.95f, 1f, 1f);
|
||||
waveText.color = UITheme.Text;
|
||||
waveText.raycastTarget = false;
|
||||
}
|
||||
|
||||
@@ -433,17 +439,10 @@ public class EnemySpawner : MonoBehaviour
|
||||
Image image = startWaveButton.GetComponent<Image>();
|
||||
if (image != null)
|
||||
{
|
||||
image.color = new Color(0.2f, 0.66f, 0.9f, 1f);
|
||||
image.color = new Color(0.08f, 0.42f, 0.61f, 1f);
|
||||
}
|
||||
|
||||
ColorBlock colors = startWaveButton.colors;
|
||||
colors.normalColor = new Color(0.2f, 0.66f, 0.9f, 1f);
|
||||
colors.highlightedColor = new Color(0.33f, 0.78f, 1f, 1f);
|
||||
colors.pressedColor = new Color(0.12f, 0.48f, 0.7f, 1f);
|
||||
colors.selectedColor = colors.highlightedColor;
|
||||
colors.disabledColor = new Color(0.18f, 0.22f, 0.27f, 0.7f);
|
||||
colors.colorMultiplier = 1f;
|
||||
startWaveButton.colors = colors;
|
||||
UITheme.StyleButton(startWaveButton);
|
||||
|
||||
TextMeshProUGUI label = startWaveButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||
if (label != null)
|
||||
@@ -467,7 +466,7 @@ public class EnemySpawner : MonoBehaviour
|
||||
label.fontSize = fontSize;
|
||||
label.fontStyle = style;
|
||||
label.alignment = TextAlignmentOptions.Center;
|
||||
label.color = new Color(0.94f, 0.96f, 1f, 1f);
|
||||
UITheme.StyleText(label);
|
||||
label.textWrappingMode = TextWrappingModes.Normal;
|
||||
label.raycastTarget = false;
|
||||
return label;
|
||||
@@ -479,18 +478,8 @@ public class EnemySpawner : MonoBehaviour
|
||||
RectTransform rect = obj.GetComponent<RectTransform>();
|
||||
rect.SetParent(parent, false);
|
||||
|
||||
Image image = obj.GetComponent<Image>();
|
||||
image.color = new Color(0.18f, 0.5f, 0.74f, 1f);
|
||||
|
||||
Button button = obj.GetComponent<Button>();
|
||||
ColorBlock colors = button.colors;
|
||||
colors.normalColor = image.color;
|
||||
colors.highlightedColor = new Color(0.25f, 0.62f, 0.88f, 1f);
|
||||
colors.pressedColor = new Color(0.12f, 0.36f, 0.56f, 1f);
|
||||
colors.selectedColor = colors.highlightedColor;
|
||||
colors.disabledColor = new Color(0.16f, 0.18f, 0.22f, 1f);
|
||||
colors.colorMultiplier = 1f;
|
||||
button.colors = colors;
|
||||
UITheme.StyleButton(button);
|
||||
button.onClick.AddListener(onClick);
|
||||
|
||||
TextMeshProUGUI text = CreateOverlayText("Text", rect, label, 18f, FontStyles.Bold);
|
||||
|
||||
@@ -9,6 +9,7 @@ public class FloatingWorldText : MonoBehaviour
|
||||
Color startColor = Color.white;
|
||||
float duration = 0.75f;
|
||||
float elapsed;
|
||||
Vector3 startScale;
|
||||
|
||||
public void Configure(float fadeDuration, Vector3 moveOffset)
|
||||
{
|
||||
@@ -20,6 +21,7 @@ public class FloatingWorldText : MonoBehaviour
|
||||
{
|
||||
text = GetComponent<TextMeshPro>();
|
||||
startPosition = transform.position;
|
||||
startScale = transform.localScale;
|
||||
if (text != null)
|
||||
startColor = text.color;
|
||||
}
|
||||
@@ -29,6 +31,7 @@ public class FloatingWorldText : MonoBehaviour
|
||||
elapsed += Time.deltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / duration);
|
||||
transform.position = Vector3.Lerp(startPosition, startPosition + offset, t);
|
||||
transform.localScale = Vector3.Lerp(startScale * 1.18f, startScale, t);
|
||||
|
||||
if (text != null)
|
||||
text.color = new Color(startColor.r, startColor.g, startColor.b, 1f - t);
|
||||
|
||||
+28
-15
@@ -76,19 +76,34 @@ public class MainMenu : MonoBehaviour
|
||||
for (int i = canvas.transform.childCount - 1; i >= 0; i--)
|
||||
Destroy(canvas.transform.GetChild(i).gameObject);
|
||||
|
||||
RectTransform root = CreatePanel("MainMenuRoot", canvas.transform, new Color(0.035f, 0.04f, 0.052f, 1f));
|
||||
UITheme.StyleCanvas(canvas, new Vector2(900f, 600f));
|
||||
RectTransform root = CreatePanel("MainMenuRoot", canvas.transform, UITheme.Background);
|
||||
root.anchorMin = Vector2.zero;
|
||||
root.anchorMax = Vector2.one;
|
||||
root.offsetMin = Vector2.zero;
|
||||
root.offsetMax = Vector2.zero;
|
||||
|
||||
TextMeshProUGUI title = CreateText("Title", root, "THE TOWER", 42f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
UITheme.AddAccent(root, "TopGlow", new Color(0.12f, 0.54f, 0.76f, 0.9f), new Vector2(0f, 1f), Vector2.one, new Vector2(0f, -4f), Vector2.zero);
|
||||
UITheme.AddAccent(root, "LeftRail", new Color(0.08f, 0.3f, 0.44f, 0.55f), Vector2.zero, new Vector2(0f, 1f), Vector2.zero, new Vector2(4f, 0f));
|
||||
UITheme.AddAccent(root, "RightRail", new Color(0.08f, 0.3f, 0.44f, 0.55f), new Vector2(1f, 0f), Vector2.one, new Vector2(-4f, 0f), Vector2.zero);
|
||||
|
||||
TextMeshProUGUI title = CreateText("Title", root, "THE TOWER", 46f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
RectTransform titleRect = title.rectTransform;
|
||||
titleRect.anchorMin = new Vector2(0f, 1f);
|
||||
titleRect.anchorMax = new Vector2(1f, 1f);
|
||||
titleRect.pivot = new Vector2(0.5f, 1f);
|
||||
titleRect.anchoredPosition = new Vector2(0f, -30f);
|
||||
titleRect.sizeDelta = new Vector2(0f, 58f);
|
||||
UITheme.StyleText(title, UITheme.Text, true);
|
||||
|
||||
TextMeshProUGUI subtitle = CreateText("Subtitle", root, "Best Tower Defense Game ever 100%", 13f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
subtitle.color = UITheme.Cyan;
|
||||
RectTransform subtitleRect = subtitle.rectTransform;
|
||||
subtitleRect.anchorMin = new Vector2(0f, 1f);
|
||||
subtitleRect.anchorMax = new Vector2(1f, 1f);
|
||||
subtitleRect.pivot = new Vector2(0.5f, 1f);
|
||||
subtitleRect.anchoredPosition = new Vector2(0f, -82f);
|
||||
subtitleRect.sizeDelta = new Vector2(0f, 24f);
|
||||
|
||||
RectTransform nav = CreateRect("Nav", root);
|
||||
nav.anchorMin = new Vector2(0f, 0f);
|
||||
@@ -109,12 +124,13 @@ public class MainMenu : MonoBehaviour
|
||||
Button towersButton = CreateButton("TowersButton", nav, "TOWERS", () => ShowTowers());
|
||||
towersTabLabel = towersButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||
|
||||
contentRoot = CreatePanel("Content", root, new Color(0.075f, 0.084f, 0.105f, 0.98f));
|
||||
contentRoot = CreatePanel("Content", root, UITheme.Panel);
|
||||
contentRoot.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
contentRoot.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
contentRoot.pivot = new Vector2(0.5f, 0.5f);
|
||||
contentRoot.anchoredPosition = new Vector2(0f, -12f);
|
||||
contentRoot.sizeDelta = new Vector2(640f, 350f);
|
||||
UITheme.AddTopAccent(contentRoot, UITheme.Cyan);
|
||||
|
||||
Button quitButton = CreateButton("QuitButton", root, "QUIT", QuitGame);
|
||||
RectTransform quitRect = quitButton.GetComponent<RectTransform>();
|
||||
@@ -131,14 +147,16 @@ public class MainMenu : MonoBehaviour
|
||||
ClearContent();
|
||||
|
||||
int stage = Mathf.Max(1, PlayerPrefs.GetInt(CurrentStageKey, 1));
|
||||
TextMeshProUGUI heading = CreateText("Heading", contentRoot, "HOME", 26f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
TextMeshProUGUI heading = CreateText("Heading", contentRoot, "MISSION CONTROL", 24f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
PlaceTop(heading.rectTransform, -34f, 36f);
|
||||
heading.color = UITheme.CyanBright;
|
||||
|
||||
TextMeshProUGUI stageText = CreateText("Stage", contentRoot, $"STAGE {stage}", 42f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
PlaceCenter(stageText.rectTransform, 0f, 76f, 320f, 60f);
|
||||
|
||||
TextMeshProUGUI detail = CreateText("Detail", contentRoot, "15 waves. Boss waves at 5, 10 and 15.", 17f, FontStyles.Normal, TextAlignmentOptions.Center);
|
||||
TextMeshProUGUI detail = CreateText("Detail", contentRoot, "15 WAVES // COMMANDERS AT 05, 10, 15", 15f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
PlaceCenter(detail.rectTransform, 0f, 8f, 460f, 34f);
|
||||
detail.color = UITheme.TextMuted;
|
||||
|
||||
Button playButton = CreateButton("PlayButton", contentRoot, "PLAY", StartGame);
|
||||
RectTransform playRect = playButton.GetComponent<RectTransform>();
|
||||
@@ -152,6 +170,7 @@ public class MainMenu : MonoBehaviour
|
||||
|
||||
TextMeshProUGUI heading = CreateText("Heading", contentRoot, "TOWERS", 26f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
PlaceTop(heading.rectTransform, -34f, 36f);
|
||||
heading.color = UITheme.CyanBright;
|
||||
|
||||
CreateTowerCard("CannonTowerCard", "CANNON TOWER", "Explosive shells with splash and heavy upgrade scaling.", CannonTowerId, true, -216f);
|
||||
CreateTowerCard("TeslaTowerCard", "TESLA TOWER", "Rapid arcs with longer range and steadier damage.", TeslaTowerId, IsTowerUnlocked(TeslaTowerId), 216f);
|
||||
@@ -165,6 +184,7 @@ public class MainMenu : MonoBehaviour
|
||||
|
||||
RectTransform card = CreatePanel(cardName, contentRoot, cardColor);
|
||||
PlaceCenter(card, x, -10f, 196f, 198f);
|
||||
UITheme.AddTopAccent(card, selected ? UITheme.Cyan : unlocked ? UITheme.Border : new Color(0.22f, 0.24f, 0.27f, 1f));
|
||||
|
||||
TextMeshProUGUI name = CreateText("Name", card, towerName, 20f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
PlaceTop(name.rectTransform, -18f, 34f);
|
||||
@@ -217,14 +237,7 @@ public class MainMenu : MonoBehaviour
|
||||
image.color = new Color(0.18f, 0.5f, 0.74f, 1f);
|
||||
|
||||
Button button = obj.GetComponent<Button>();
|
||||
ColorBlock colors = button.colors;
|
||||
colors.normalColor = image.color;
|
||||
colors.highlightedColor = new Color(0.25f, 0.62f, 0.88f, 1f);
|
||||
colors.pressedColor = new Color(0.12f, 0.36f, 0.56f, 1f);
|
||||
colors.selectedColor = colors.highlightedColor;
|
||||
colors.disabledColor = new Color(0.16f, 0.18f, 0.22f, 1f);
|
||||
colors.colorMultiplier = 1f;
|
||||
button.colors = colors;
|
||||
UITheme.StyleButton(button);
|
||||
button.onClick.AddListener(onClick);
|
||||
|
||||
TextMeshProUGUI text = CreateText("Text", rect, label, 18f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
@@ -240,7 +253,7 @@ public class MainMenu : MonoBehaviour
|
||||
GameObject obj = new GameObject(name, typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
RectTransform rect = obj.GetComponent<RectTransform>();
|
||||
rect.SetParent(parent, false);
|
||||
obj.GetComponent<Image>().color = color;
|
||||
UITheme.StylePanel(obj.GetComponent<Image>(), color);
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -263,7 +276,7 @@ public class MainMenu : MonoBehaviour
|
||||
label.fontSize = fontSize;
|
||||
label.fontStyle = style;
|
||||
label.alignment = alignment;
|
||||
label.color = new Color(0.91f, 0.94f, 0.98f, 1f);
|
||||
UITheme.StyleText(label);
|
||||
label.textWrappingMode = TextWrappingModes.Normal;
|
||||
label.raycastTarget = false;
|
||||
return label;
|
||||
|
||||
@@ -6,6 +6,8 @@ public class ShockwaveEffect : MonoBehaviour
|
||||
float duration = 0.28f;
|
||||
float elapsed;
|
||||
Vector3 startScale;
|
||||
Color startColor;
|
||||
Color endColor;
|
||||
|
||||
public void Configure(float effectDuration)
|
||||
{
|
||||
@@ -17,6 +19,11 @@ public class ShockwaveEffect : MonoBehaviour
|
||||
line = GetComponent<LineRenderer>();
|
||||
startScale = transform.localScale * 0.35f;
|
||||
transform.localScale = startScale;
|
||||
if (line != null)
|
||||
{
|
||||
startColor = line.startColor;
|
||||
endColor = line.endColor;
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -27,9 +34,8 @@ public class ShockwaveEffect : MonoBehaviour
|
||||
|
||||
if (line != null)
|
||||
{
|
||||
Color color = Color.Lerp(new Color(0.95f, 0.82f, 0.45f, 0.8f), new Color(0.95f, 0.82f, 0.45f, 0f), t);
|
||||
line.startColor = color;
|
||||
line.endColor = color;
|
||||
line.startColor = new Color(startColor.r, startColor.g, startColor.b, Mathf.Lerp(startColor.a, 0f, t));
|
||||
line.endColor = new Color(endColor.r, endColor.g, endColor.b, Mathf.Lerp(endColor.a, 0f, t));
|
||||
}
|
||||
|
||||
if (elapsed >= duration)
|
||||
|
||||
@@ -8,9 +8,9 @@ public class Tower : MonoBehaviour
|
||||
|
||||
public static Tower Instance;
|
||||
public GameObject bulletPrefab;
|
||||
public int damage = 1;
|
||||
public int damage = 2;
|
||||
public float fireRate = 1f;
|
||||
public float attackRange = 5f;
|
||||
public float attackRange = 6f;
|
||||
public float splashRadius = 1.15f;
|
||||
public float splashDamageMultiplier = 0.45f;
|
||||
public float shellDamageMultiplier = 1f;
|
||||
@@ -112,7 +112,9 @@ public class Tower : MonoBehaviour
|
||||
rangeObject.transform.position = transform.position;
|
||||
rangeCircle = rangeObject.GetComponent<SpriteRenderer>();
|
||||
rangeCircle.sprite = CreateCircleSprite();
|
||||
rangeCircle.color = new Color(0.72f, 0.74f, 0.78f, 0.16f);
|
||||
rangeCircle.color = isTeslaTower
|
||||
? new Color(0.22f, 0.78f, 1f, 0.2f)
|
||||
: new Color(1f, 0.68f, 0.22f, 0.16f);
|
||||
rangeCircle.sortingOrder = -10;
|
||||
UpdateRangeCircle();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TowerHealth : MonoBehaviour
|
||||
if (healthFill != null)
|
||||
{
|
||||
healthFill.fillAmount = 1f;
|
||||
healthFill.color = Color.Lerp(lowHealthColor, highHealthColor, healthPercentage);
|
||||
healthFill.color = Color.Lerp(UITheme.Red, UITheme.Green, healthPercentage);
|
||||
|
||||
RectTransform fillRect = healthFill.rectTransform;
|
||||
fillRect.anchorMax = new Vector2(healthPercentage, fillRect.anchorMax.y);
|
||||
@@ -101,7 +101,8 @@ public class TowerHealth : MonoBehaviour
|
||||
Image panel = container.GetComponent<Image>();
|
||||
if (panel == null)
|
||||
panel = container.gameObject.AddComponent<Image>();
|
||||
panel.color = new Color(0.05f, 0.06f, 0.08f, 0.84f);
|
||||
UITheme.StylePanel(panel, UITheme.Panel, UITheme.Border);
|
||||
UITheme.AddTopAccent(container, UITheme.Green, 3f);
|
||||
|
||||
TextMeshProUGUI label = container.Find("Label")?.GetComponent<TextMeshProUGUI>();
|
||||
if (label == null)
|
||||
@@ -184,10 +185,12 @@ public class TowerHealth : MonoBehaviour
|
||||
rect.SetAsLastSibling();
|
||||
|
||||
Image background = overlay.GetComponent<Image>();
|
||||
background.color = new Color(0f, 0f, 0f, 0.8f);
|
||||
background.color = new Color(0.005f, 0.012f, 0.022f, 0.92f);
|
||||
background.raycastTarget = true;
|
||||
|
||||
TextMeshProUGUI title = CreateText("Title", rect, "STAGE LOST", 44f);
|
||||
UITheme.AddAccent(rect, "DefeatLine", UITheme.Red, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-220f, 110f), new Vector2(220f, 113f));
|
||||
TextMeshProUGUI title = CreateText("Title", rect, "CORE BREACHED", 44f);
|
||||
title.color = UITheme.Red;
|
||||
title.alignment = TextAlignmentOptions.Center;
|
||||
PlaceOverlayRect(title.rectTransform, 0f, 64f, 420f, 68f);
|
||||
|
||||
@@ -232,7 +235,7 @@ public class TowerHealth : MonoBehaviour
|
||||
label.text = text;
|
||||
label.fontSize = fontSize;
|
||||
label.fontStyle = FontStyles.Bold;
|
||||
label.color = new Color(0.92f, 0.95f, 1f, 1f);
|
||||
UITheme.StyleText(label);
|
||||
label.raycastTarget = false;
|
||||
return label;
|
||||
}
|
||||
@@ -243,18 +246,8 @@ public class TowerHealth : MonoBehaviour
|
||||
RectTransform rect = obj.GetComponent<RectTransform>();
|
||||
rect.SetParent(parent, false);
|
||||
|
||||
Image image = obj.GetComponent<Image>();
|
||||
image.color = new Color(0.18f, 0.5f, 0.74f, 1f);
|
||||
|
||||
Button button = obj.GetComponent<Button>();
|
||||
ColorBlock colors = button.colors;
|
||||
colors.normalColor = image.color;
|
||||
colors.highlightedColor = new Color(0.25f, 0.62f, 0.88f, 1f);
|
||||
colors.pressedColor = new Color(0.12f, 0.36f, 0.56f, 1f);
|
||||
colors.selectedColor = colors.highlightedColor;
|
||||
colors.disabledColor = new Color(0.16f, 0.18f, 0.22f, 1f);
|
||||
colors.colorMultiplier = 1f;
|
||||
button.colors = colors;
|
||||
UITheme.StyleButton(button);
|
||||
button.onClick.AddListener(onClick);
|
||||
|
||||
TextMeshProUGUI text = CreateText("Text", rect, label, 18f);
|
||||
|
||||
@@ -49,7 +49,10 @@ public class UpgradeManager : MonoBehaviour
|
||||
Action currentChoiceComplete;
|
||||
int bonusBitsPerKill;
|
||||
float hitBitChance;
|
||||
float salvageProgress;
|
||||
int rerollCost = 1;
|
||||
const float BaseBitsPerKill = 0.5f;
|
||||
const float SalvageBonusPerStack = 0.15f;
|
||||
|
||||
static readonly CardDefinition[] CannonCards =
|
||||
{
|
||||
@@ -118,7 +121,12 @@ public class UpgradeManager : MonoBehaviour
|
||||
|
||||
public void EnemyKilled()
|
||||
{
|
||||
bits += 1 + bonusBitsPerKill;
|
||||
salvageProgress += BaseBitsPerKill + bonusBitsPerKill * SalvageBonusPerStack;
|
||||
while (salvageProgress >= 1f)
|
||||
{
|
||||
bits++;
|
||||
salvageProgress -= 1f;
|
||||
}
|
||||
UpdateBitsText();
|
||||
}
|
||||
|
||||
@@ -179,7 +187,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
if (!upgradeLevels.ContainsKey(card.type))
|
||||
upgradeLevels[card.type] = 0;
|
||||
if (!upgradeCosts.ContainsKey(card.type))
|
||||
upgradeCosts[card.type] = card.baseCost;
|
||||
upgradeCosts[card.type] = Mathf.CeilToInt(card.baseCost * 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +222,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
freeType = FreeUpgradeType.KillBonus,
|
||||
isFree = true,
|
||||
title = $"SALVAGE BONUS {ToRoman(bonusBitsPerKill + 1)}",
|
||||
description = "Enemies killed give +1 extra bit from now on.",
|
||||
description = "Enemies contribute +15% more salvage toward Bits.",
|
||||
footer = "Free",
|
||||
rarity = "Supply"
|
||||
},
|
||||
@@ -222,8 +230,8 @@ public class UpgradeManager : MonoBehaviour
|
||||
{
|
||||
freeType = FreeUpgradeType.HitBonus,
|
||||
isFree = true,
|
||||
title = $"SCRAP ROUNDS {ToRoman(Mathf.RoundToInt(hitBitChance / 0.4f) + 1)}",
|
||||
description = "Bullet hits gain a +40% chance to give 1 bit.",
|
||||
title = $"SCRAP ROUNDS {ToRoman(Mathf.RoundToInt(hitBitChance / 0.15f) + 1)}",
|
||||
description = "Bullet hits gain a +15% chance to give 1 bit.",
|
||||
footer = "Free",
|
||||
rarity = "Supply"
|
||||
}
|
||||
@@ -315,6 +323,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
outline.effectColor = GetRarityBorderColor(offer.rarity);
|
||||
RarityPulse pulse = cardObject.AddComponent<RarityPulse>();
|
||||
pulse.Configure(outline, GetRarityBorderColor(offer.rarity));
|
||||
UITheme.AddTopAccent(cardRect, GetRarityBorderColor(offer.rarity), 4f);
|
||||
|
||||
Button button = cardObject.GetComponent<Button>();
|
||||
ColorBlock colors = button.colors;
|
||||
@@ -328,6 +337,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
button.onClick.AddListener(() => SelectOffer(offer));
|
||||
|
||||
TextMeshProUGUI rarity = CreateText("Rarity", cardRect, offer.rarity.ToUpperInvariant(), 11f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
rarity.color = GetRarityBorderColor(offer.rarity);
|
||||
TextMeshProUGUI title = CreateText("Title", cardRect, offer.title, 16f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
TextMeshProUGUI description = CreateText("Description", cardRect, offer.description, 12f, FontStyles.Normal, TextAlignmentOptions.TopLeft);
|
||||
TextMeshProUGUI footer = CreateText("Footer", cardRect, offer.footer, 14f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
@@ -641,7 +651,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
bonusBitsPerKill++;
|
||||
break;
|
||||
case FreeUpgradeType.HitBonus:
|
||||
hitBitChance += 0.4f;
|
||||
hitBitChance += 0.15f;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -721,21 +731,42 @@ public class UpgradeManager : MonoBehaviour
|
||||
rect.pivot = new Vector2(0f, 1f);
|
||||
rect.anchoredPosition = new Vector2(24f, -24f);
|
||||
rect.sizeDelta = new Vector2(170f, 42f);
|
||||
EnsureBitsPanel(rect);
|
||||
}
|
||||
|
||||
bitsText.alignment = TextAlignmentOptions.Center;
|
||||
bitsText.fontSize = 21f;
|
||||
bitsText.fontStyle = FontStyles.Bold;
|
||||
bitsText.color = new Color(0.98f, 0.87f, 0.32f, 1f);
|
||||
bitsText.color = UITheme.Amber;
|
||||
bitsText.raycastTarget = false;
|
||||
|
||||
Outline outline = bitsText.GetComponent<Outline>();
|
||||
if (outline == null)
|
||||
outline = bitsText.gameObject.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(0f, 0f, 0f, 0.55f);
|
||||
outline.effectColor = new Color(0f, 0f, 0f, 0.72f);
|
||||
outline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
}
|
||||
|
||||
static void EnsureBitsPanel(RectTransform bitsRect)
|
||||
{
|
||||
Transform parent = bitsRect.parent;
|
||||
if (parent == null || parent.Find("BitsCounterPanel") != null)
|
||||
return;
|
||||
|
||||
GameObject panelObject = new GameObject("BitsCounterPanel", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
RectTransform panel = panelObject.GetComponent<RectTransform>();
|
||||
panel.SetParent(parent, false);
|
||||
panel.anchorMin = bitsRect.anchorMin;
|
||||
panel.anchorMax = bitsRect.anchorMax;
|
||||
panel.pivot = bitsRect.pivot;
|
||||
panel.anchoredPosition = bitsRect.anchoredPosition;
|
||||
panel.sizeDelta = bitsRect.sizeDelta;
|
||||
panel.SetSiblingIndex(bitsRect.GetSiblingIndex());
|
||||
|
||||
UITheme.StylePanel(panelObject.GetComponent<Image>(), UITheme.Panel, new Color(0.66f, 0.5f, 0.16f, 0.85f));
|
||||
UITheme.AddTopAccent(panel, UITheme.Amber, 3f);
|
||||
}
|
||||
|
||||
GameObject CreateOverlay(bool freeFallback)
|
||||
{
|
||||
Canvas canvas = bitsText.GetComponentInParent<Canvas>();
|
||||
@@ -749,11 +780,12 @@ public class UpgradeManager : MonoBehaviour
|
||||
rect.SetAsLastSibling();
|
||||
|
||||
Image image = overlay.GetComponent<Image>();
|
||||
image.color = new Color(0f, 0f, 0f, 0.74f);
|
||||
image.color = new Color(0.005f, 0.012f, 0.022f, 0.88f);
|
||||
image.raycastTarget = true;
|
||||
|
||||
string titleText = freeFallback ? "LOW BITS: CHOOSE SUPPLY BOOST" : IsTeslaTowerSelected() ? "CHOOSE TESLA UPGRADE" : "CHOOSE CANNON UPGRADE";
|
||||
TextMeshProUGUI title = CreateText("Title", rect, titleText, 28f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
title.color = IsTeslaTowerSelected() ? UITheme.CyanBright : UITheme.Amber;
|
||||
RectTransform titleRect = title.rectTransform;
|
||||
titleRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
titleRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
@@ -770,6 +802,9 @@ public class UpgradeManager : MonoBehaviour
|
||||
bitsRect.anchoredPosition = new Vector2(0f, 104f);
|
||||
bitsRect.sizeDelta = new Vector2(220f, 30f);
|
||||
|
||||
RectTransform headerLine = UITheme.AddAccent(rect, "HeaderLine", new Color(0.18f, 0.56f, 0.72f, 0.75f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-260f, 88f), new Vector2(260f, 90f));
|
||||
headerLine.SetAsFirstSibling();
|
||||
|
||||
return overlay;
|
||||
}
|
||||
|
||||
@@ -827,18 +862,8 @@ public class UpgradeManager : MonoBehaviour
|
||||
RectTransform rect = obj.GetComponent<RectTransform>();
|
||||
rect.SetParent(parent, false);
|
||||
|
||||
Image image = obj.GetComponent<Image>();
|
||||
image.color = new Color(0.18f, 0.5f, 0.74f, 1f);
|
||||
|
||||
Button button = obj.GetComponent<Button>();
|
||||
ColorBlock colors = button.colors;
|
||||
colors.normalColor = image.color;
|
||||
colors.highlightedColor = new Color(0.25f, 0.62f, 0.88f, 1f);
|
||||
colors.pressedColor = new Color(0.12f, 0.36f, 0.56f, 1f);
|
||||
colors.selectedColor = colors.highlightedColor;
|
||||
colors.disabledColor = new Color(0.16f, 0.18f, 0.22f, 0.82f);
|
||||
colors.colorMultiplier = 1f;
|
||||
button.colors = colors;
|
||||
UITheme.StyleButton(button, true);
|
||||
button.onClick.AddListener(onClick);
|
||||
|
||||
TextMeshProUGUI text = CreateText("Text", rect, label, 16f, FontStyles.Bold, TextAlignmentOptions.Center);
|
||||
@@ -860,7 +885,7 @@ public class UpgradeManager : MonoBehaviour
|
||||
label.fontSize = fontSize;
|
||||
label.fontStyle = style;
|
||||
label.alignment = alignment;
|
||||
label.color = new Color(0.9f, 0.93f, 0.98f, 1f);
|
||||
UITheme.StyleText(label);
|
||||
label.textWrappingMode = TextWrappingModes.Normal;
|
||||
label.raycastTarget = false;
|
||||
return label;
|
||||
|
||||
Reference in New Issue
Block a user