1335 lines
76 KiB
C#
1335 lines
76 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using GazeLab.Combat;
|
|
using GazeLab.Core;
|
|
using GazeLab.Data;
|
|
using GazeLab.Entities;
|
|
using GazeLab.Environment;
|
|
using GazeLab.InputSystem;
|
|
using GazeLab.UI;
|
|
using UnityEditor;
|
|
using UnityEditor.SceneManagement;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace GazeLab.EditorTools
|
|
{
|
|
public static class GazeLabSetupWizard
|
|
{
|
|
private const string BaseSoFolder = "Assets/GazeLab/ScriptableObjects";
|
|
private const string MainScenePath = "Assets/GazeLab/Scene/Main.unity";
|
|
|
|
private static readonly Dictionary<string, Sprite> spriteLookup = new Dictionary<string, Sprite>();
|
|
|
|
[InitializeOnLoadMethod]
|
|
private static void AutoSetupOnFirstLoad()
|
|
{
|
|
EditorApplication.delayCall += () =>
|
|
{
|
|
if (EditorApplication.isPlayingOrWillChangePlaymode) return;
|
|
if (!File.Exists(Path.Combine(Application.dataPath, "GazeLab/ScriptableObjects/WaveCatalog_Main.asset")))
|
|
{
|
|
BuildAllAssetsAndSetupScene();
|
|
}
|
|
};
|
|
}
|
|
|
|
[MenuItem("GazeLab/Setup Scene & Prefabs (1-Click Build)", priority = 1)]
|
|
public static void BuildAllAssetsAndSetupScene()
|
|
{
|
|
EnsureDirectories();
|
|
IndexAllGazeLabSprites();
|
|
|
|
// 1. Build Centroid Opacity Profiles (Shields & Shockwave Explosions)
|
|
var stationShieldProfile = CreateShieldProfile("Centroid_StationShield_360", "Ability_Shield_Double_360", "Ability_Shield_Ripple_180", "Ability_Shield_Broken_360", new Vector2(0.5f, 0.5f), 0.24f, 0.48f, new Color(0.35f, 0.92f, 1f, 0.92f));
|
|
var enemyShieldProfile = CreateShieldProfile("Centroid_EnemyShield_360", "Ability_Shield_360", "Ability_Shield_Ripple_180", "Ability_Shield_Broken", new Vector2(0.5f, 0.5f), 0.22f, 0.47f, new Color(0.45f, 0.78f, 1f, 0.88f));
|
|
var bossShieldProfile = CreateShieldProfile("Centroid_BossShield_Dome", "Ability_Shield_Flashy", "Ability_Shield_Ripple_180", "Ability_Shield_Broken_360", new Vector2(0.5f, 0.35f), 0.20f, 0.48f, new Color(1f, 0.65f, 0.25f, 0.9f));
|
|
|
|
var fireExpProfile = CreateExplosionProfile("Centroid_Exp_Fire", "Projectile_Energy_Explosion_Fire", new Color(1f, 0.75f, 0.35f));
|
|
var electroExpProfile = CreateExplosionProfile("Centroid_Exp_Electric", "Projectile_Energy_Explosion_Electric", new Color(0.35f, 0.95f, 1f));
|
|
var poisonExpProfile = CreateExplosionProfile("Centroid_Exp_Poison", "Projectile_Energy_Explosion_Poison", new Color(0.45f, 1f, 0.45f));
|
|
var voidExpProfile = CreateExplosionProfile("Centroid_Exp_Void", "Projectile_Energy_Explosion_Void", new Color(0.82f, 0.45f, 1f));
|
|
var plasmaExpProfile = CreateExplosionProfile("Centroid_Exp_Plasma", "Projectile_Energy_Explosion_ElectricPlasma", new Color(0.45f, 0.85f, 1f));
|
|
|
|
// 2. Build Projectile Definitions (Including -45 deg offset for diagonal rockets!)
|
|
var projBulletLv1 = CreateProjectile("Proj_Physical_Bullet", "Projectile_Physicall_Bullet_withTrail_Simple", 0f,
|
|
TrajectoryType.StraightBallistic, 12.5f, 14f, 1.0f, 0.75f, 1.25f, 1.35f, StatusEffectType.BleedShrapnel, fireExpProfile);
|
|
projBulletLv1.bonusAsteroidSplitChance = 0.15f;
|
|
|
|
var projBulletDouble = CreateProjectile("Proj_Physical_DoubleBullet", "Projectile_Physicall_Bullet_Double_withTrail", 0f,
|
|
TrajectoryType.StraightBallistic, 13.5f, 22f, 1.0f, 0.8f, 1.3f, 1.4f, StatusEffectType.BleedShrapnel, fireExpProfile);
|
|
projBulletDouble.bonusAsteroidSplitChance = 0.22f;
|
|
|
|
// Diagonal Rockets drawn at ~45 degrees -> spriteRotationOffsetDeg = -45f!
|
|
var projRocketHoming = CreateProjectile("Proj_Physical_HomingRocket", "Projectile_Physicall_Rocket_withFire", -45f,
|
|
TrajectoryType.HomingMissile, 8.8f, 38f, 1.15f, 1.15f, 1.35f, 1.5f, StatusEffectType.BleedShrapnel, fireExpProfile);
|
|
projRocketHoming.homingTurnRateDeg = 220f;
|
|
projRocketHoming.aoeExplosionRadius = 1.25f;
|
|
projRocketHoming.visualScale = 0.36f;
|
|
|
|
var projGaussSlug = CreateProjectile("Proj_Gauss_Slug", "Projectile_Gauss_Simple_WithTrail", 0f,
|
|
TrajectoryType.StraightBallistic, 16.5f, 30f, 0.9f, 1.85f, 1.2f, 1.25f, StatusEffectType.ArmorShred, plasmaExpProfile);
|
|
projGaussSlug.pierceCount = 1;
|
|
|
|
var projGaussSniper = CreateProjectile("Proj_Gauss_Sniper", "Projectile_Gauss_Stardust", 0f,
|
|
TrajectoryType.StraightBallistic, 20f, 68f, 1.1f, 2.2f, 1.4f, 1.5f, StatusEffectType.ArmorShred, plasmaExpProfile);
|
|
projGaussSniper.pierceCount = 3;
|
|
|
|
var projPlasmaBolt = CreateProjectile("Proj_Plasma_Bolt", "Projectile_Energy_Simple_Blue", 0f,
|
|
TrajectoryType.StraightBallistic, 13f, 24f, 1.35f, 1.15f, 1.25f, 1.1f, StatusEffectType.PlasmaBurn, plasmaExpProfile);
|
|
projPlasmaBolt.statusPotency = 7f;
|
|
|
|
var projElectroBolt = CreateProjectile("Proj_Electro_Bolt", "Projectile_Energy_Simple_WithTrail_Electric", 0f,
|
|
TrajectoryType.StraightBallistic, 14f, 19f, 2.15f, 0.95f, 1.0f, 1.0f, StatusEffectType.ElectroChainStun, electroExpProfile);
|
|
projElectroBolt.chainTargetsCount = 2;
|
|
projElectroBolt.chainRange = 3.0f;
|
|
|
|
var projWaveCone = CreateProjectile("Proj_Microwave_Cone", "Projectile_Energy_Wave_Long", 0f,
|
|
TrajectoryType.ExpandingWave, 8.5f, 18f, 1.25f, 1.1f, 1.1f, 1.3f, StatusEffectType.MicrowaveRepulseSlow, plasmaExpProfile);
|
|
projWaveCone.knockbackForce = 3.2f;
|
|
projWaveCone.pierceCount = 8;
|
|
|
|
var projPoisonCorrosive = CreateProjectile("Proj_Special_Corrosive", "Projectile_Energy_Simple_WithTrail_Poison", 0f,
|
|
TrajectoryType.SineWaveSnake, 11.5f, 22f, 1.1f, 1.6f, 1.4f, 1.2f, StatusEffectType.CorrosiveDoT, poisonExpProfile);
|
|
projPoisonCorrosive.statusPotency = 9f;
|
|
|
|
var projVoidSingularity = CreateProjectile("Proj_Special_VoidBall", "Projectile_Special_voidBall", 0f,
|
|
TrajectoryType.StraightBallistic, 9.2f, 45f, 1.4f, 1.5f, 1.4f, 1.5f, StatusEffectType.VoidGravityPull, voidExpProfile);
|
|
projVoidSingularity.aoeExplosionRadius = 1.65f;
|
|
|
|
var projHarpoonChain = CreateProjectile("Proj_Ability_Harpoon", "Projectile_Physicall_Harpoon2", 0f,
|
|
TrajectoryType.TetherHarpoon, 17f, 32f, 1.2f, 1.3f, 1.3f, 1.5f, StatusEffectType.HarpoonGrappleTether, electroExpProfile);
|
|
projHarpoonChain.visualScale = 0.44f;
|
|
|
|
var projEnemyLaser = CreateProjectile("Proj_Enemy_Laser", "Projectile_Energy_Simple_Violett_WithTrail", 0f,
|
|
TrajectoryType.StraightBallistic, 6.2f, 11f, 1.0f, 1.0f, 1.0f, 1.0f, StatusEffectType.None, plasmaExpProfile);
|
|
projEnemyLaser.visualScale = 0.32f;
|
|
|
|
var projEnemyRocket = CreateProjectile("Proj_Enemy_Rocket", "Projectile_Physicall_Rocket_withSmoke", -45f,
|
|
TrajectoryType.HomingMissile, 5.2f, 18f, 1.1f, 1.1f, 1.15f, 1.0f, StatusEffectType.None, fireExpProfile);
|
|
projEnemyRocket.homingTurnRateDeg = 95f;
|
|
projEnemyRocket.visualScale = 0.32f;
|
|
|
|
// 3. Build Branching Weapon Tech Trees
|
|
// Physical Tree: LvL1 -> LvL2 -> LvL3 -> Branch A (LvL5 Sniper) / Branch B (LvL5 RapidFire)
|
|
var wepPhysLv5Sniper = CreateWeapon("Wep_Phys_Lv5_Sniper", "Heavy Rail-Cannon V", WeaponFamily.Physical, 5,
|
|
"Weapon_Physical_LvL5_Sniper", 2, FiringPattern.SimultaneousVolley, 1.6f, projBulletDouble, new ResourceCost(65, 12, 2));
|
|
var wepPhysLv5Rapid = CreateWeapon("Wep_Phys_Lv5_Rapid", "Quad Vulcan Battery V", WeaponFamily.Physical, 5,
|
|
"Weapon_Physical_LvL5_RapidFire", 4, FiringPattern.AlternatingSequential, 6.2f, projBulletDouble, new ResourceCost(60, 10, 2));
|
|
var wepPhysLv3 = CreateWeapon("Wep_Phys_Lv3", "Twin Autocannon III", WeaponFamily.Physical, 3,
|
|
"Weapon_Physical_LvL3_RapidFire", 2, FiringPattern.AlternatingSequential, 4.2f, projBulletDouble, new ResourceCost(38, 4, 0),
|
|
wepPhysLv5Sniper, wepPhysLv5Rapid);
|
|
var wepPhysLv2 = CreateWeapon("Wep_Phys_Lv2", "Rapid Autocannon II", WeaponFamily.Physical, 2,
|
|
"Weapon_Physical_LvL2_RapidFire", 2, FiringPattern.AlternatingSequential, 3.3f, projBulletLv1, new ResourceCost(22, 0, 0),
|
|
wepPhysLv3);
|
|
var wepPhysLv1 = CreateWeapon("Wep_Phys_Lv1", "Light Autocannon I", WeaponFamily.Physical, 1,
|
|
"Weapon_Physical_LvL1", 1, FiringPattern.AlternatingSequential, 2.5f, projBulletLv1, new ResourceCost(15, 0, 0),
|
|
wepPhysLv2);
|
|
|
|
// Gauss Tree: LvL1 -> LvL3 -> Branch A (LvL5 Sniper) / Branch B (LvL5 RapidFire)
|
|
var wepGaussLv5Sniper = CreateWeapon("Wep_Gauss_Lv5_Sniper", "Hyper-Gauss Lance V", WeaponFamily.Gauss, 5,
|
|
"Weapon_Gauss_LvL5_Sniper", 1, FiringPattern.SimultaneousVolley, 1.25f, projGaussSniper, new ResourceCost(70, 16, 4));
|
|
var wepGaussLv5Rapid = CreateWeapon("Wep_Gauss_Lv5_Rapid", "Gauss Repeater V", WeaponFamily.Gauss, 5,
|
|
"Weapon_Gauss_LvL5_RapidFire", 2, FiringPattern.BurstRipple, 3.4f, projGaussSlug, new ResourceCost(65, 14, 3));
|
|
var wepGaussLv3 = CreateWeapon("Wep_Gauss_Lv3", "Heavy Coilgun III", WeaponFamily.Gauss, 3,
|
|
"Weapon_Gauss_LvL3", 1, FiringPattern.SimultaneousVolley, 1.85f, projGaussSlug, new ResourceCost(42, 6, 0),
|
|
wepGaussLv5Sniper, wepGaussLv5Rapid);
|
|
var wepGaussLv1 = CreateWeapon("Wep_Gauss_Lv1", "Gauss Coilgun I", WeaponFamily.Gauss, 1,
|
|
"Weapon_Gauss_LvL1", 1, FiringPattern.SimultaneousVolley, 1.45f, projGaussSlug, new ResourceCost(24, 2, 0),
|
|
wepGaussLv3);
|
|
|
|
// Plasma Tree: LvL1 -> LvL3 -> Branch A (LvL5 Sniper) / Branch B (LvL5 RapidFire)
|
|
var wepPlasmaLv5Sniper = CreateWeapon("Wep_Plasma_Lv5_Sniper", "Sunfire Lance V", WeaponFamily.Plasma, 5,
|
|
"Weapon_Plasma_LvL5_Sniper", 1, FiringPattern.SimultaneousVolley, 1.6f, projPlasmaBolt, new ResourceCost(65, 15, 3));
|
|
var wepPlasmaLv5Rapid = CreateWeapon("Wep_Plasma_Lv5_Rapid", "Twin Plasma Gatling V", WeaponFamily.Plasma, 5,
|
|
"Weapon_Plasma_LvL5_RapidFire", 2, FiringPattern.AlternatingSequential, 4.8f, projPlasmaBolt, new ResourceCost(62, 14, 3));
|
|
var wepPlasmaLv3 = CreateWeapon("Wep_Plasma_Lv3", "Plasma Accelerator III", WeaponFamily.Plasma, 3,
|
|
"Weapon_Plasma_LvL3_energy", 2, FiringPattern.AlternatingSequential, 3.2f, projPlasmaBolt, new ResourceCost(40, 5, 0),
|
|
wepPlasmaLv5Sniper, wepPlasmaLv5Rapid);
|
|
var wepPlasmaLv1 = CreateWeapon("Wep_Plasma_Lv1", "Plasma Blaster I", WeaponFamily.Plasma, 1,
|
|
"Weapon_Plasma_LvL1", 1, FiringPattern.AlternatingSequential, 2.3f, projPlasmaBolt, new ResourceCost(22, 2, 0),
|
|
wepPlasmaLv3);
|
|
|
|
// Electro Tree: LvL1 -> LvL3 -> LvL5
|
|
var wepElectroLv5 = CreateWeapon("Wep_Electro_Lv5", "Stormlord Arc Cannon V", WeaponFamily.Electro, 5,
|
|
"Weapon_ElectroBullets_LvL5", 2, FiringPattern.BurstRipple, 3.6f, projElectroBolt, new ResourceCost(65, 15, 3));
|
|
var wepElectroLv3 = CreateWeapon("Wep_Electro_Lv3", "Tesla Chain Emitter III", WeaponFamily.Electro, 3,
|
|
"Weapon_ElectroBullets_LvL3_energy", 2, FiringPattern.AlternatingSequential, 2.7f, projElectroBolt, new ResourceCost(38, 6, 0),
|
|
wepElectroLv5);
|
|
var wepElectroLv1 = CreateWeapon("Wep_Electro_Lv1", "Arc Disruptor I", WeaponFamily.Electro, 1,
|
|
"Weapon_ElectroBullets_LvL1", 1, FiringPattern.AlternatingSequential, 2.1f, projElectroBolt, new ResourceCost(22, 2, 0),
|
|
wepElectroLv3);
|
|
|
|
// Microwave Tree: LvL1 -> LvL3 -> LvL6 AoE
|
|
var wepWaveLv6AoE = CreateWeapon("Wep_Wave_Lv6_AoE", "Shockwave Repulsor VI", WeaponFamily.Microwave, 6,
|
|
"Weapon_Wave_LvL6_AoE", 1, FiringPattern.SpreadCone, 1.8f, projWaveCone, new ResourceCost(68, 16, 4));
|
|
var wepWaveLv3 = CreateWeapon("Wep_Wave_Lv3", "Pulse Wave Projector III", WeaponFamily.Microwave, 3,
|
|
"Weapon_Wave_LvL3", 1, FiringPattern.SimultaneousVolley, 1.4f, projWaveCone, new ResourceCost(38, 5, 0),
|
|
wepWaveLv6AoE);
|
|
var wepWaveLv1 = CreateWeapon("Wep_Wave_Lv1", "Microwave Emitter I", WeaponFamily.Microwave, 1,
|
|
"Weapon_Wave_LvL1", 1, FiringPattern.SimultaneousVolley, 1.15f, projWaveCone, new ResourceCost(24, 2, 0),
|
|
wepWaveLv3);
|
|
|
|
// Special / Exotic Tree: Rocket Launcher -> Corrosive Nano -> Void Singularity
|
|
var wepSpecialVoid = CreateWeapon("Wep_Special_Void", "Singularity Cannon V", WeaponFamily.Special, 5,
|
|
"Weapon_Special_VoidBalls", 1, FiringPattern.SimultaneousVolley, 0.95f, projVoidSingularity, new ResourceCost(75, 18, 5));
|
|
var wepSpecialPoison = CreateWeapon("Wep_Special_Poison", "Nano-Corrosive Injector III", WeaponFamily.Special, 3,
|
|
"Weapon_Special_PoisonOrNano", 2, FiringPattern.AlternatingSequential, 2.6f, projPoisonCorrosive, new ResourceCost(45, 8, 1),
|
|
wepSpecialVoid);
|
|
var wepSpecialRockets = CreateWeapon("Wep_Special_RocketLauncher", "Swarm Missile Pod I", WeaponFamily.Special, 1,
|
|
"Weapon_RocketLauncher", 2, FiringPattern.AlternatingSequential, 1.4f, projRocketHoming, new ResourceCost(28, 3, 0),
|
|
wepSpecialPoison, wepSpecialVoid);
|
|
|
|
// Enemy Turret Weapons
|
|
var wepEnemyLight = CreateWeapon("Wep_Enemy_Light", "Enemy Pulse Gun", WeaponFamily.Plasma, 1,
|
|
"Weapon_Plasma_LvL1", 1, FiringPattern.AlternatingSequential, 0.55f, projEnemyLaser, new ResourceCost(0, 0, 0));
|
|
var wepEnemyDouble = CreateWeapon("Wep_Enemy_Double", "Enemy Twin Blaster", WeaponFamily.Physical, 2,
|
|
"Weapon_Physical_LvL2_RapidFire", 2, FiringPattern.AlternatingSequential, 0.72f, projEnemyLaser, new ResourceCost(0, 0, 0));
|
|
var wepEnemyRocketPod = CreateWeapon("Wep_Enemy_Rockets", "Enemy Missile Launcher", WeaponFamily.Physical, 3,
|
|
"Weapon_RocketLauncher", 2, FiringPattern.SimultaneousVolley, 0.38f, projEnemyRocket, new ResourceCost(0, 0, 0));
|
|
var wepEnemyGauss = CreateWeapon("Wep_Enemy_Gauss", "Enemy Gauss Cannon", WeaponFamily.Gauss, 3,
|
|
"Weapon_Gauss_LvL3", 1, FiringPattern.SimultaneousVolley, 0.48f, projEnemyLaser, new ResourceCost(0, 0, 0));
|
|
|
|
// 4. Build Space Station Levels 1-8 (with Dynamic World Scale Multiplier!)
|
|
StationLevelDefinition[] stationLevels = new StationLevelDefinition[8];
|
|
string[] stationTitles =
|
|
{
|
|
"Tiny Satellite", "Small Upgrade", "Expansion Module", "Outpost Station",
|
|
"Command Center", "Mega Dreadnought Citadel", "Planetary Bastion", "Apex Star Fortress"
|
|
};
|
|
string[] stationSpriteNames =
|
|
{
|
|
"SpaceStation_Lvl1", "SpaceStation_Lvl2", "SpaceStation_Lvl3", "SpaceStation_Lvl4",
|
|
"SpaceStation_Lvl5", "SpaceStation_Lvl6", "SpaceStation_Lvl7", "SpaceStation_Lvl8"
|
|
};
|
|
// As Station grows, enemies/projectiles shrink from 1.00x down to 0.40x!
|
|
float[] worldScales = { 1.00f, 0.88f, 0.78f, 0.68f, 0.60f, 0.52f, 0.45f, 0.40f };
|
|
float[] stationScales = { 0.36f, 0.40f, 0.44f, 0.48f, 0.52f, 0.56f, 0.60f, 0.65f };
|
|
int[] requiredWaves = { 0, 5, 10, 15, 20, 25, 30, 35 };
|
|
|
|
Vector2[][] hardpointLayouts =
|
|
{
|
|
new[] { new Vector2(0f, 0.45f) },
|
|
new[] { new Vector2(0f, 0.55f), new Vector2(-2.0145607f, 2.2710001f), new Vector2(2.5289166f, 1.5981112f) },
|
|
new[] { new Vector2(0f, 0.60f), new Vector2(-2.0145607f, 2.2710001f), new Vector2(2.5289166f, 1.5981112f), new Vector2(0f, -0.35f) },
|
|
new[] { new Vector2(0f, 0.65f), new Vector2(-0.95f, 0.30f), new Vector2(0.95f, 0.30f), new Vector2(0f, -0.35f) },
|
|
new[] { new Vector2(0f, 0.70f), new Vector2(-1.05f, 0.35f), new Vector2(1.05f, 0.35f), new Vector2(0f, -0.35f) },
|
|
new[] { new Vector2(0f, 0.75f), new Vector2(-1.15f, 0.40f), new Vector2(1.15f, 0.40f), new Vector2(-0.65f, -0.35f), new Vector2(0.65f, -0.35f) },
|
|
new[] { new Vector2(0f, 0.80f), new Vector2(-1.20f, 0.45f), new Vector2(1.20f, 0.45f), new Vector2(-0.75f, -0.35f), new Vector2(0.75f, -0.35f) },
|
|
new[] { new Vector2(0f, 0.85f), new Vector2(-1.25f, 0.50f), new Vector2(1.25f, 0.50f), new Vector2(-0.85f, -0.30f), new Vector2(0.85f, -0.30f), new Vector2(0f, -0.60f) }
|
|
};
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
{
|
|
int lvl = i + 1;
|
|
var stDef = LoadOrCreateSo<StationLevelDefinition>($"Station/StationLevel_{lvl}");
|
|
bool preserveCustomHardpoints = stDef.turretHardpoints != null && stDef.turretHardpoints.Length >= hardpointLayouts[i].Length;
|
|
stDef.level = lvl;
|
|
stDef.title = stationTitles[i];
|
|
stDef.requiredWaveCleared = requiredWaves[i];
|
|
// Level 2 costs only 25 Scrap (guaranteed to be earned in Waves 1-5!)
|
|
stDef.upgradeCost = lvl == 2
|
|
? new ResourceCost(25, 0, 0)
|
|
: new ResourceCost(25 + i * 22, Mathf.Max(0, (i - 1) * 4), Mathf.Max(0, (i - 3) * 2));
|
|
stDef.stationSprite = FindSprite(stationSpriteNames[i]);
|
|
stDef.stationVisualScale = stationScales[i];
|
|
stDef.worldEntityScaleMultiplier = worldScales[i];
|
|
stDef.mountedTurretScaleMultiplier = Mathf.Lerp(0.75f, 0.52f, i / 7f);
|
|
stDef.maxHull = 160f + i * 85f;
|
|
stDef.maxShield = i == 0 ? 0f : (80f + i * 55f);
|
|
stDef.shieldRegenPerSec = i == 0 ? 0f : (7f + i * 3.5f);
|
|
stDef.passiveMagnetRadius = 2.4f + i * 0.35f;
|
|
stDef.shieldCentroidProfile = stationShieldProfile;
|
|
if (!preserveCustomHardpoints)
|
|
{
|
|
stDef.turretHardpoints = hardpointLayouts[i];
|
|
}
|
|
EditorUtility.SetDirty(stDef);
|
|
stationLevels[i] = stDef;
|
|
}
|
|
|
|
// 5. Build Station Active Abilities (Including Harpoon Grapple Chain!)
|
|
var abHarpoon = LoadOrCreateSo<StationAbilityDefinition>("Abilities/Ability_HarpoonGrapple");
|
|
abHarpoon.abilityId = "ability_harpoon";
|
|
abHarpoon.displayName = "Harpoon Chain";
|
|
abHarpoon.abilityType = StationAbilityType.HarpoonGrappleChain;
|
|
abHarpoon.hotkey = KeyCode.Alpha1;
|
|
abHarpoon.requiredStationLevel = 2;
|
|
abHarpoon.unlockCost = new ResourceCost(18, 0, 0);
|
|
abHarpoon.upgradeCostPerTier = new ResourceCost(30, 5, 1);
|
|
abHarpoon.maxAbilityTier = 3;
|
|
abHarpoon.cooldownSeconds = 9f;
|
|
abHarpoon.activeDurationSeconds = 5f;
|
|
abHarpoon.baseChainCount = 1;
|
|
abHarpoon.pullInStandOffDistance = 2.0f;
|
|
abHarpoon.pullSpeed = 4.5f;
|
|
abHarpoon.focusFireDamageBonusMultiplier = 1.3f;
|
|
abHarpoon.projectilePrefabDefinition = projHarpoonChain;
|
|
abHarpoon.iconSprite = FindSprite("Projectile_Physicall_Harpoon2");
|
|
EditorUtility.SetDirty(abHarpoon);
|
|
|
|
var abEmp = LoadOrCreateSo<StationAbilityDefinition>("Abilities/Ability_EmpShockwave");
|
|
abEmp.abilityId = "ability_emp";
|
|
abEmp.displayName = "EMP Wave";
|
|
abEmp.abilityType = StationAbilityType.EmpShockwave;
|
|
abEmp.hotkey = KeyCode.Alpha2;
|
|
abEmp.requiredStationLevel = 2;
|
|
abEmp.unlockCost = new ResourceCost(22, 2, 0);
|
|
abEmp.upgradeCostPerTier = new ResourceCost(35, 6, 1);
|
|
abEmp.cooldownSeconds = 13f;
|
|
abEmp.effectPotency = 32f;
|
|
abEmp.projectilePrefabDefinition = projElectroBolt;
|
|
abEmp.visualEffectProfile = electroExpProfile;
|
|
abEmp.iconSprite = FindSprite("UI_Icon_Energy");
|
|
EditorUtility.SetDirty(abEmp);
|
|
|
|
var abAegis = LoadOrCreateSo<StationAbilityDefinition>("Abilities/Ability_AegisOvercharge");
|
|
abAegis.abilityId = "ability_aegis";
|
|
abAegis.displayName = "Aegis Dome";
|
|
abAegis.abilityType = StationAbilityType.AegisShieldOvercharge;
|
|
abAegis.hotkey = KeyCode.Alpha3;
|
|
abAegis.requiredStationLevel = 3;
|
|
abAegis.unlockCost = new ResourceCost(30, 5, 0);
|
|
abAegis.upgradeCostPerTier = new ResourceCost(40, 8, 2);
|
|
abAegis.cooldownSeconds = 15f;
|
|
abAegis.visualEffectProfile = stationShieldProfile;
|
|
abAegis.iconSprite = FindSprite("UI_Icon_Shield");
|
|
EditorUtility.SetDirty(abAegis);
|
|
|
|
var abSwarm = LoadOrCreateSo<StationAbilityDefinition>("Abilities/Ability_MissileSwarm");
|
|
abSwarm.abilityId = "ability_swarm";
|
|
abSwarm.displayName = "Missile Swarm";
|
|
abSwarm.abilityType = StationAbilityType.MissileSwarm;
|
|
abSwarm.hotkey = KeyCode.Alpha4;
|
|
abSwarm.requiredStationLevel = 4;
|
|
abSwarm.unlockCost = new ResourceCost(40, 8, 1);
|
|
abSwarm.upgradeCostPerTier = new ResourceCost(50, 12, 3);
|
|
abSwarm.cooldownSeconds = 14f;
|
|
abSwarm.projectilePrefabDefinition = projRocketHoming;
|
|
abSwarm.iconSprite = FindSprite("UI_Icon_Fire");
|
|
EditorUtility.SetDirty(abSwarm);
|
|
|
|
// 6. Build Tutorial Tooltips (Pause + OK Button Briefings)
|
|
var tipWelcome = CreateTooltip("Tip_Welcome", "ORBITAL DEFENSE SYSTEMS ONLINE",
|
|
"Gaze & Mouse Lock-On + Instant Resource Tractor",
|
|
"• COMBAT LOCK-ON: Hold your Cursor or Tobii Eye Gaze over Asteroids and Enemy Ships to fill the reticle ring and fire.\n" +
|
|
"• INSTANT LOOT TRACTOR: Simply sweep your Cursor or Gaze over drifting Scrap, Gold, or Uranium to suck them straight into your station!\n" +
|
|
"• INPUT SWITCHING: Press [TAB] or click the top-right Input button anytime to switch between Mouse, Tobii 4C Eye Tracker, and Keyboard.",
|
|
FindSprite("SpaceStation_Lvl1"), new Color(0.35f, 0.95f, 1f));
|
|
|
|
var tipWave5Boss = CreateTooltip("Tip_Wave5Boss", "BOSS ALERT — HOSTILE RAIDER DETECTED!",
|
|
"Wave 5 Boss & Station Level 2 Unlock",
|
|
"• A Violett Raider Fighter has entered the sector as the Wave 5 Boss!\n" +
|
|
"• Defeating this Boss unlocks SPACE STATION LEVEL 2 in the Docking Shop, along with the GRAPPLE HARPOON CHAIN ability and new Turret Hardpoints!\n" +
|
|
"• Once defeated, regular fighters will begin appearing in standard waves.",
|
|
FindSprite("Ship_Violett_Base_Healthy"), new Color(1f, 0.78f, 0.25f));
|
|
|
|
var tipWave10Armored = CreateTooltip("Tip_Wave10Armored", "ARMORED GUNSHIP & HARPOON CHAINS",
|
|
"Heavy Armor & Multi-Chain Lockdown",
|
|
"• ARMORED ENEMIES mitigate standard kinetic bullets. Use GAUSS COILGUNS (Armor Shred) or CORROSIVE weapons to pierce their plating!\n" +
|
|
"• HARPOON GRAPPLE [1]: Fires a chain link that reels enemies close, disables their maneuvers, and forces all turrets to Focus-Fire them.\n" +
|
|
"• Bosses require MULTIPLE HARPOON CHAINS (upgrade your Harpoon ability in the Shop to launch additional chains!).",
|
|
FindSprite("Ship_Red_Armored_Healthy"), new Color(1f, 0.55f, 0.25f));
|
|
|
|
var tipWave15Shielded = CreateTooltip("Tip_Wave15Shielded", "SHIELDED CRUISER DETECTED",
|
|
"Energy Shields & Tesla Disruptors",
|
|
"• This cruiser projects a regenerative Energy Shield around its hull.\n" +
|
|
"• ELECTRO / TESLA turrets deal 200% bonus damage to Shields, arc chain-lightning to nearby ships, and briefly STUN enemy weapon mounts!",
|
|
FindSprite("Ship_Green_Armored_Healthy"), new Color(0.35f, 0.95f, 1f));
|
|
|
|
var tipWave20Dreadnought = CreateTooltip("Tip_Wave20Dreadnought", "CAPITAL DREADNOUGHT BOSS!",
|
|
"Multi-Part Targetable Boss Hardpoints",
|
|
"• Capital Dreadnoughts mount multiple heavy weapon batteries on their wings.\n" +
|
|
"• You can lock your Gaze / Cursor directly onto individual BOSS TURRETS to blow them off, permanently disabling those attacks and earning bonus Gold!",
|
|
FindSprite("Boss1_Red_Base_Healthy"), new Color(1f, 0.35f, 0.35f));
|
|
|
|
// 7. Build Enemy & Boss Archetypes
|
|
var enemyViolettScout = CreateEnemy("Enemy_Violett_Scout", "Violett Raider", "Light Fighter",
|
|
"Ship_Violett_Base_Healthy", "Ship_Violett_Base_Damaged", "Ship_Violett_Base_Broken",
|
|
55f, false, 0f, null, 1, EnemyStrafePattern.SineWeave, 4.1f, 0.30f,
|
|
new[] { new EnemyHardpointSlot { partName = "Pulse Nose", localOffset = new Vector2(1.4f, 0f), weapon = wepEnemyLight, turretScaleMultiplier = 0.55f } },
|
|
new ResourceCost(6, 1, 0), null);
|
|
|
|
var enemyBlueInterceptor = CreateEnemy("Enemy_Blue_Interceptor", "Blue Striker", "Twin-Gun Interceptor",
|
|
"Ship_Blue_Base_Healthy", "Ship_Blue_Base_Damaged", "Ship_Blue_Base_Broken",
|
|
75f, false, 30f, enemyShieldProfile, 1, EnemyStrafePattern.PeriodicDiveRun, 4.0f, 0.31f,
|
|
new[] { new EnemyHardpointSlot { partName = "Twin Blaster", localOffset = new Vector2(1.4f, 0f), weapon = wepEnemyDouble, turretScaleMultiplier = 0.58f } },
|
|
new ResourceCost(8, 1, 0), null);
|
|
|
|
var enemyRedArmoredGunship = CreateEnemy("Enemy_Red_Armored", "Crimson Bombardier", "Armored Missile Gunship",
|
|
"Ship_Red_Armored_Healthy", "Ship_Red_Armored_Damaged", "Ship_Red_Armored_Broken",
|
|
145f, true, 45f, enemyShieldProfile, 2, EnemyStrafePattern.PingPongHorizontal, 4.5f, 0.35f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Port Launcher", localOffset = new Vector2(0.8f, 0.85f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.58f },
|
|
new EnemyHardpointSlot { partName = "Starboard Launcher", localOffset = new Vector2(0.8f, -0.85f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.58f }
|
|
},
|
|
new ResourceCost(14, 3, 1), tipWave10Armored);
|
|
|
|
var enemyGreenArmoredCruiser = CreateEnemy("Enemy_Green_Armored", "Emerald Aegis Cruiser", "Shielded Gauss Cruiser",
|
|
"Ship_Green_Armored_Healthy", "Ship_Green_Armored_Damaged", "Ship_Green_Armored_Broken",
|
|
190f, true, 120f, enemyShieldProfile, 2, EnemyStrafePattern.OrbitArc, 4.7f, 0.37f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Gauss Battery", localOffset = new Vector2(1.2f, 0f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.65f },
|
|
new EnemyHardpointSlot { partName = "Wing Blaster", localOffset = new Vector2(0.5f, 0.9f), weapon = wepEnemyDouble, turretScaleMultiplier = 0.52f }
|
|
},
|
|
new ResourceCost(18, 4, 1), tipWave15Shielded);
|
|
|
|
var enemyOrangeHeavy = CreateEnemy("Enemy_Orange_Armored", "Solaris Vanguard", "Heavy Assault Frigate",
|
|
"Ship_Orange_Armored_Healthy", "Ship_Orange_Armored_Damaged", "Ship_Orange_Armored_Broken",
|
|
240f, true, 140f, enemyShieldProfile, 2, EnemyStrafePattern.HeavyStandoff, 4.4f, 0.39f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Heavy Cannon", localOffset = new Vector2(1.3f, 0.65f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.62f },
|
|
new EnemyHardpointSlot { partName = "Missile Pod", localOffset = new Vector2(1.3f, -0.65f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.62f }
|
|
},
|
|
new ResourceCost(22, 5, 2), null);
|
|
|
|
// Multi-Part Capital Dreadnought Bosses (with Destructible Wing Turrets!)
|
|
var bossRedDreadnought = CreateEnemy("Boss_Red_Dreadnought", "Ares Capital Dreadnought", "Multi-Turret Warship",
|
|
"Boss1_Red_Base_Healthy", "Boss1_Red_Base_Damaged", "Boss1_Red_Base_Broken",
|
|
520f, true, 240f, bossShieldProfile, 3, EnemyStrafePattern.HeavyStandoff, 4.8f, 0.48f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Left Wing Missile Pod", localOffset = new Vector2(0.6f, 1.35f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.72f, isDestructibleSubPart = true, subPartMaxHealth = 120f, bonusScrapOnBreak = 12, bonusGoldOnBreak = 3 },
|
|
new EnemyHardpointSlot { partName = "Right Wing Gauss Battery", localOffset = new Vector2(0.6f, -1.35f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.72f, isDestructibleSubPart = true, subPartMaxHealth = 120f, bonusScrapOnBreak = 12, bonusGoldOnBreak = 3 },
|
|
new EnemyHardpointSlot { partName = "Central Core Blaster", localOffset = new Vector2(1.6f, 0f), weapon = wepEnemyDouble, turretScaleMultiplier = 0.78f, isDestructibleSubPart = false, subPartMaxHealth = 150f }
|
|
},
|
|
new ResourceCost(45, 10, 4), tipWave20Dreadnought);
|
|
|
|
var bossViolettCarrier = CreateEnemy("Boss_Violett_Dreadnought", "Void Sovereign Carrier", "Armored Capital Dreadnought",
|
|
"Boss1_Violett_Armored_Healthy", "Boss1_Violett_Armored_Damaged", "Boss1_Violett_Armored_Broken",
|
|
760f, true, 360f, bossShieldProfile, 3, EnemyStrafePattern.HeavyStandoff, 4.9f, 0.50f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Port Gauss Turret", localOffset = new Vector2(0.6f, 1.4f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.75f, isDestructibleSubPart = true, subPartMaxHealth = 165f, bonusScrapOnBreak = 15, bonusGoldOnBreak = 4 },
|
|
new EnemyHardpointSlot { partName = "Starboard Gauss Turret", localOffset = new Vector2(0.6f, -1.4f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.75f, isDestructibleSubPart = true, subPartMaxHealth = 165f, bonusScrapOnBreak = 15, bonusGoldOnBreak = 4 },
|
|
new EnemyHardpointSlot { partName = "Core Missile Battery", localOffset = new Vector2(1.5f, 0f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.80f, isDestructibleSubPart = true, subPartMaxHealth = 190f, bonusScrapOnBreak = 18, bonusGoldOnBreak = 5 }
|
|
},
|
|
new ResourceCost(65, 14, 6), null);
|
|
|
|
var bossApexCitadel = CreateEnemy("Boss_Apex_Citadel", "Omega Armored Leviathan", "Supreme Dreadnought",
|
|
"Boss2_Armored_Healthy", "Boss2_Armored_Damaged", "Boss2_Armored_Broken",
|
|
1100f, true, 500f, bossShieldProfile, 3, EnemyStrafePattern.HeavyStandoff, 5.0f, 0.54f,
|
|
new[]
|
|
{
|
|
new EnemyHardpointSlot { partName = "Port Wing Battery", localOffset = new Vector2(0.5f, 1.45f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.78f, isDestructibleSubPart = true, subPartMaxHealth = 220f, bonusScrapOnBreak = 20, bonusGoldOnBreak = 5 },
|
|
new EnemyHardpointSlot { partName = "Starboard Wing Battery", localOffset = new Vector2(0.5f, -1.45f), weapon = wepEnemyRocketPod, turretScaleMultiplier = 0.78f, isDestructibleSubPart = true, subPartMaxHealth = 220f, bonusScrapOnBreak = 20, bonusGoldOnBreak = 5 },
|
|
new EnemyHardpointSlot { partName = "Central Siege Cannon", localOffset = new Vector2(1.6f, 0f), weapon = wepEnemyGauss, turretScaleMultiplier = 0.85f, isDestructibleSubPart = true, subPartMaxHealth = 260f, bonusScrapOnBreak = 25, bonusGoldOnBreak = 6 }
|
|
},
|
|
new ResourceCost(90, 20, 10), null);
|
|
|
|
// 8. Build Wave Catalog (Boss every 5 Waves + Boss-First Enemy Introductions + Former Bosses as Elites!)
|
|
var catalog = LoadOrCreateSo<WaveCatalog>("WaveCatalog_Main");
|
|
catalog.bossWaveInterval = 5;
|
|
catalog.baseBigAsteroidSplitChance = 0.28f;
|
|
|
|
catalog.normalAsteroidSprites = FindSprites("Asteroid_Normal_small", "Asteroid_Normal_Mid", "Asteroid_Normal_Big", "Asteroid_Normal_Huge");
|
|
catalog.scrapAsteroidSprites = FindSprites("Asteroid_Scrap_Small", "Asteroid_Scrap_Mid", "Asteroid_Scrap_Big", "Rare_Asteroid_Scrap_Big");
|
|
catalog.goldAsteroidSprites = FindSprites("Asteroid_Gold_Small", "Asteroid_Gold_Normal", "Asteroid_Gold_Big", "Rare_Asteroid_Gold_Big");
|
|
catalog.uraniumAsteroidSprites = FindSprites("Asteroid_Uranium_small", "Asteroid_Uranium_Mid", "Asteroid_Uranium_Big", "Rare_Asteroid_Uranium_Big");
|
|
|
|
catalog.scrapLootSprites = FindSprites("Ressource_Scrap_Small", "Ressource_Scrap_Mid", "Ressource_Scrap_Big");
|
|
catalog.goldLootSprites = FindSprites("Ressource_Gold_Small", "Ressource_Gold_Mid", "Ressource_Gold_Big");
|
|
catalog.uraniumLootSprites = FindSprites("Ressource_Uranium_Small", "Ressource_Uranium_Mid", "Ressource_Uranium_Large");
|
|
|
|
// 8b. Build Authored ScriptableObject Waves (Wave 1 to 5)
|
|
catalog.authoredWaves = BuildAuthoredWaveSOs(
|
|
enemyViolettScout, enemyBlueInterceptor, tipWave5Boss);
|
|
|
|
catalog.waves = BuildAuthored30WaveProgression(
|
|
enemyViolettScout, enemyBlueInterceptor, enemyRedArmoredGunship,
|
|
enemyGreenArmoredCruiser, enemyOrangeHeavy,
|
|
bossRedDreadnought, bossViolettCarrier, bossApexCitadel,
|
|
tipWave5Boss);
|
|
|
|
EditorUtility.SetDirty(catalog);
|
|
AssetDatabase.SaveAssets();
|
|
|
|
// 8c. Build Modular Tech Tree Definition
|
|
var treeDef = BuildUpgradeTreeDefinition(
|
|
stationLevels,
|
|
wepPhysLv1, wepElectroLv1, wepGaussLv1, wepPlasmaLv1, wepWaveLv1, wepSpecialRockets, wepSpecialVoid,
|
|
abHarpoon, abEmp, abAegis, abSwarm);
|
|
|
|
// 9. Wire Up Main.unity Scene
|
|
SetupMainScene(
|
|
catalog,
|
|
treeDef,
|
|
stationLevels,
|
|
wepPhysLv1,
|
|
new[] { wepPhysLv1, wepGaussLv1, wepPlasmaLv1, wepElectroLv1, wepWaveLv1, wepSpecialRockets, wepSpecialVoid },
|
|
new[] { abHarpoon, abEmp, abAegis, abSwarm },
|
|
tipWelcome);
|
|
|
|
AssetDatabase.SaveAssets();
|
|
AssetDatabase.Refresh();
|
|
Debug.Log("[GazeLabSetupWizard] Successfully generated all ScriptableObjects, calibrated Weapon Pivots/Muzzles, and wired Main.unity!");
|
|
}
|
|
|
|
private static WaveDefinition[] BuildAuthored30WaveProgression(
|
|
EnemyArchetypeDefinition violettScout,
|
|
EnemyArchetypeDefinition blueStriker,
|
|
EnemyArchetypeDefinition redArmored,
|
|
EnemyArchetypeDefinition greenCruiser,
|
|
EnemyArchetypeDefinition orangeHeavy,
|
|
EnemyArchetypeDefinition bossRed,
|
|
EnemyArchetypeDefinition bossViolett,
|
|
EnemyArchetypeDefinition bossApex,
|
|
TutorialTooltipDefinition tipWave5)
|
|
{
|
|
List<WaveDefinition> list = new List<WaveDefinition>();
|
|
|
|
// Waves 1-4: Short, brisk Asteroid-only waves with guaranteed minimum Scrap so Wave 5 Level 2 upgrade is 100% affordable
|
|
list.Add(new WaveDefinition { waveNumber = 1, waveTitle = "Outer Asteroid Drift", normalAsteroidCount = 4, resourceAsteroidCount = 3, asteroidSpawnInterval = 1.15f, guaranteedMinimumYield = new ResourceCost(10, 0, 0) });
|
|
list.Add(new WaveDefinition { waveNumber = 2, waveTitle = "Scrap Field Alpha", normalAsteroidCount = 5, resourceAsteroidCount = 4, rareUraniumGoldRatio = 0.25f, asteroidSpawnInterval = 1.05f, guaranteedMinimumYield = new ResourceCost(12, 1, 0) });
|
|
list.Add(new WaveDefinition { waveNumber = 3, waveTitle = "Dense Meteor Shower", normalAsteroidCount = 6, resourceAsteroidCount = 4, rareUraniumGoldRatio = 0.30f, asteroidSpawnInterval = 0.95f, guaranteedMinimumYield = new ResourceCost(14, 1, 0) });
|
|
list.Add(new WaveDefinition { waveNumber = 4, waveTitle = "Rich Mineral Cluster", normalAsteroidCount = 6, resourceAsteroidCount = 5, rareUraniumGoldRatio = 0.35f, asteroidSpawnInterval = 0.90f, guaranteedMinimumYield = new ResourceCost(16, 2, 0) });
|
|
|
|
// WAVE 5 BOSS 1: Introduces the first regular Enemy Ship (Violett Scout) as a Boss! Unlocks Station Level 2.
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 5,
|
|
waveTitle = "Violett Raider Boss",
|
|
isBossWave = true,
|
|
waveStartTooltip = tipWave5,
|
|
normalAsteroidCount = 3,
|
|
resourceAsteroidCount = 3,
|
|
asteroidSpawnInterval = 1.2f,
|
|
guaranteedMinimumYield = new ResourceCost(25, 3, 0),
|
|
enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = violettScout, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.32f, healthMultiplier = 2.4f, damageMultiplier = 1.0f, initialSpawnDelay = 1.0f, spawnInterval = 2f }
|
|
}
|
|
});
|
|
|
|
// Waves 6-9: Regular fighters now appear as standard enemies alongside asteroids
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 6, waveTitle = "Raider Patrol", normalAsteroidCount = 5, resourceAsteroidCount = 4, rareUraniumGoldRatio = 0.35f, asteroidSpawnInterval = 1.05f,
|
|
guaranteedMinimumYield = new ResourceCost(18, 2, 0),
|
|
enemyGroups = new[] { new WaveEnemyGroup { archetype = violettScout, count = 2, roleScaleMultiplier = 1.0f, healthMultiplier = 1.0f, damageMultiplier = 1.0f, initialSpawnDelay = 1.5f, spawnInterval = 3.0f } }
|
|
});
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 7, waveTitle = "Twin-Blaster Recon", normalAsteroidCount = 6, resourceAsteroidCount = 4, rareUraniumGoldRatio = 0.4f, asteroidSpawnInterval = 1.0f,
|
|
guaranteedMinimumYield = new ResourceCost(20, 3, 1),
|
|
enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = violettScout, count = 2, roleScaleMultiplier = 1.0f, healthMultiplier = 1.1f, damageMultiplier = 1.0f, initialSpawnDelay = 1.2f, spawnInterval = 2.5f },
|
|
new WaveEnemyGroup { archetype = blueStriker, count = 1, roleScaleMultiplier = 1.05f, healthMultiplier = 1.1f, damageMultiplier = 1.0f, initialSpawnDelay = 3.5f, spawnInterval = 3.0f }
|
|
}
|
|
});
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 8, waveTitle = "Interceptor Skirmish", normalAsteroidCount = 6, resourceAsteroidCount = 5, rareUraniumGoldRatio = 0.45f, asteroidSpawnInterval = 0.95f,
|
|
guaranteedMinimumYield = new ResourceCost(22, 4, 1),
|
|
enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = blueStriker, count = 2, roleScaleMultiplier = 1.0f, healthMultiplier = 1.15f, damageMultiplier = 1.0f, initialSpawnDelay = 1.5f, spawnInterval = 2.8f }
|
|
}
|
|
});
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 9, waveTitle = "Vanguard Sweep", normalAsteroidCount = 7, resourceAsteroidCount = 5, rareUraniumGoldRatio = 0.5f, asteroidSpawnInterval = 0.95f,
|
|
guaranteedMinimumYield = new ResourceCost(24, 4, 1),
|
|
enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = violettScout, count = 2, roleScaleMultiplier = 1.0f, healthMultiplier = 1.2f, damageMultiplier = 1.05f, initialSpawnDelay = 1.0f, spawnInterval = 2.2f },
|
|
new WaveEnemyGroup { archetype = blueStriker, count = 2, roleScaleMultiplier = 1.0f, healthMultiplier = 1.2f, damageMultiplier = 1.05f, initialSpawnDelay = 3.0f, spawnInterval = 2.6f }
|
|
}
|
|
});
|
|
|
|
// WAVE 10 BOSS 2: Introduces the Armored Missile Gunship (Red Armored) + 2 Scout Escorts! Unlocks Station Level 3.
|
|
list.Add(new WaveDefinition
|
|
{
|
|
waveNumber = 10,
|
|
waveTitle = "Crimson Armored Gunship Boss",
|
|
isBossWave = true,
|
|
normalAsteroidCount = 4,
|
|
resourceAsteroidCount = 4,
|
|
rareUraniumGoldRatio = 0.55f,
|
|
asteroidSpawnInterval = 1.1f,
|
|
guaranteedMinimumYield = new ResourceCost(35, 6, 2),
|
|
enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = redArmored, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.3f, healthMultiplier = 2.0f, damageMultiplier = 1.1f, initialSpawnDelay = 1.0f, spawnInterval = 2f },
|
|
new WaveEnemyGroup { archetype = violettScout, count = 2, isWaveBossLead = false, roleScaleMultiplier = 0.95f, healthMultiplier = 1.1f, damageMultiplier = 1.0f, initialSpawnDelay = 3.2f, spawnInterval = 3.0f }
|
|
}
|
|
});
|
|
|
|
// Waves 11-30 with Bosses at 15, 20, 25, 30 and former Bosses returning as Scaled-Down Elites!
|
|
for (int w = 11; w <= 30; w++)
|
|
{
|
|
bool isBoss = (w % 5) == 0;
|
|
WaveDefinition wd = new WaveDefinition
|
|
{
|
|
waveNumber = w,
|
|
isBossWave = isBoss,
|
|
normalAsteroidCount = isBoss ? 5 : 6 + (w / 4),
|
|
resourceAsteroidCount = 4 + (w / 5),
|
|
rareUraniumGoldRatio = Mathf.Clamp01(0.45f + w * 0.015f),
|
|
asteroidSpawnInterval = Mathf.Max(0.65f, 1.05f - w * 0.01f),
|
|
asteroidSpeedMultiplier = 1f + w * 0.02f,
|
|
guaranteedMinimumYield = new ResourceCost(22 + w * 2, 3 + w / 3, 1 + w / 5)
|
|
};
|
|
|
|
if (w == 15)
|
|
{
|
|
// Wave 15 Boss 3: Introduces Shielded Gauss Cruiser + Escorts
|
|
wd.waveTitle = "Emerald Aegis Cruiser Boss";
|
|
wd.enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = greenCruiser, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.3f, healthMultiplier = 2.1f, damageMultiplier = 1.15f, initialSpawnDelay = 1f, spawnInterval = 2f },
|
|
new WaveEnemyGroup { archetype = redArmored, count = 1, roleScaleMultiplier = 0.95f, healthMultiplier = 1.1f, damageMultiplier = 1.0f, initialSpawnDelay = 3.5f, spawnInterval = 3f },
|
|
new WaveEnemyGroup { archetype = blueStriker, count = 2, roleScaleMultiplier = 0.95f, healthMultiplier = 1.15f, damageMultiplier = 1.0f, initialSpawnDelay = 2.5f, spawnInterval = 2.5f }
|
|
};
|
|
}
|
|
else if (w == 20)
|
|
{
|
|
// Wave 20 Boss 4: First Multi-Part Capital Dreadnought (Boss1_Red)!
|
|
wd.waveTitle = "Ares Capital Dreadnought";
|
|
wd.enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = bossRed, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.2f, healthMultiplier = 1.5f, damageMultiplier = 1.2f, initialSpawnDelay = 1.2f, spawnInterval = 2f },
|
|
new WaveEnemyGroup { archetype = greenCruiser, count = 2, roleScaleMultiplier = 0.9f, healthMultiplier = 1.1f, damageMultiplier = 1.05f, initialSpawnDelay = 4.0f, spawnInterval = 3.5f }
|
|
};
|
|
}
|
|
else if (w == 25)
|
|
{
|
|
// Wave 25 Boss 5: Void Sovereign Carrier + Scaled-Down Ares Elite Escort!
|
|
wd.waveTitle = "Void Sovereign Fleet";
|
|
wd.enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = bossViolett, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.25f, healthMultiplier = 1.65f, damageMultiplier = 1.25f, initialSpawnDelay = 1.2f, spawnInterval = 2f },
|
|
new WaveEnemyGroup { archetype = bossRed, count = 1, isWaveBossLead = false, roleScaleMultiplier = 0.72f, healthMultiplier = 0.85f, damageMultiplier = 1.05f, initialSpawnDelay = 4.5f, spawnInterval = 4f }
|
|
};
|
|
}
|
|
else if (w == 30)
|
|
{
|
|
// Wave 30 Boss 6: Omega Armored Leviathan + Dual Scaled-Down Dreadnought Elites!
|
|
wd.waveTitle = "Omega Leviathan Armada";
|
|
wd.enemyGroups = new[]
|
|
{
|
|
new WaveEnemyGroup { archetype = bossApex, count = 1, isWaveBossLead = true, roleScaleMultiplier = 1.3f, healthMultiplier = 1.8f, damageMultiplier = 1.35f, initialSpawnDelay = 1.2f, spawnInterval = 2f },
|
|
new WaveEnemyGroup { archetype = bossRed, count = 2, isWaveBossLead = false, roleScaleMultiplier = 0.68f, healthMultiplier = 0.9f, damageMultiplier = 1.1f, initialSpawnDelay = 4.0f, spawnInterval = 4.5f }
|
|
};
|
|
}
|
|
else
|
|
{
|
|
// Standard waves 11-14, 16-19, 21-24, 26-29: Progressive mix including former bosses as scaled-down Elites!
|
|
wd.waveTitle = w > 20 ? $"Citadel Perimeter Sector {w}" : $"Deep Space Sector {w}";
|
|
List<WaveEnemyGroup> groups = new List<WaveEnemyGroup>
|
|
{
|
|
new WaveEnemyGroup { archetype = blueStriker, count = 2 + (w / 8), roleScaleMultiplier = 0.95f, healthMultiplier = 1f + w * 0.05f, damageMultiplier = 1f + w * 0.02f, initialSpawnDelay = 1.0f, spawnInterval = 2.4f },
|
|
new WaveEnemyGroup { archetype = redArmored, count = 1 + (w / 10), roleScaleMultiplier = 0.95f, healthMultiplier = 1f + w * 0.05f, damageMultiplier = 1f + w * 0.02f, initialSpawnDelay = 2.6f, spawnInterval = 3.0f }
|
|
};
|
|
if (w >= 16)
|
|
{
|
|
groups.Add(new WaveEnemyGroup { archetype = w % 2 == 0 ? greenCruiser : orangeHeavy, count = 1 + (w / 12), roleScaleMultiplier = 0.95f, healthMultiplier = 1f + w * 0.05f, damageMultiplier = 1f + w * 0.02f, initialSpawnDelay = 4.0f, spawnInterval = 3.5f });
|
|
}
|
|
if (w >= 22)
|
|
{
|
|
// Former Wave 20 Boss now spawns as a scaled-down Elite ship!
|
|
groups.Add(new WaveEnemyGroup { archetype = bossRed, count = 1, isWaveBossLead = false, roleScaleMultiplier = 0.68f, healthMultiplier = 0.75f, damageMultiplier = 1.0f, initialSpawnDelay = 5.5f, spawnInterval = 4.5f });
|
|
}
|
|
wd.enemyGroups = groups.ToArray();
|
|
}
|
|
|
|
list.Add(wd);
|
|
}
|
|
|
|
return list.ToArray();
|
|
}
|
|
|
|
private static void SetupMainScene(
|
|
WaveCatalog catalog,
|
|
UpgradeTreeDefinitionSO treeDef,
|
|
StationLevelDefinition[] stationLevels,
|
|
WeaponDefinition startingWeapon,
|
|
WeaponDefinition[] rootWeapons,
|
|
StationAbilityDefinition[] abilities,
|
|
TutorialTooltipDefinition welcomeTooltip)
|
|
{
|
|
Scene scene = EditorSceneManager.OpenScene(MainScenePath, OpenSceneMode.Single);
|
|
|
|
// Configure Main Camera
|
|
Camera mainCam = Camera.main;
|
|
if (mainCam == null)
|
|
{
|
|
GameObject camGo = new GameObject("Main Camera", typeof(Camera), typeof(AudioListener));
|
|
camGo.tag = "MainCamera";
|
|
mainCam = camGo.GetComponent<Camera>();
|
|
}
|
|
mainCam.orthographic = true;
|
|
mainCam.orthographicSize = 5.2f;
|
|
mainCam.transform.position = new Vector3(0f, 0f, -10f);
|
|
mainCam.clearFlags = CameraClearFlags.SolidColor;
|
|
mainCam.backgroundColor = new Color(0.02f, 0.03f, 0.07f, 1f);
|
|
|
|
// Clear old generated root objects so running the wizard multiple times is idempotent
|
|
string[] managedRootNames = { "GazeLab_Systems", "GazeLab_ParallaxBackground", "GazeLab_SpaceStation", "GazeLab_UI" };
|
|
foreach (GameObject rootObj in scene.GetRootGameObjects())
|
|
{
|
|
for (int i = 0; i < managedRootNames.Length; i++)
|
|
{
|
|
if (rootObj.name == managedRootNames[i])
|
|
{
|
|
Object.DestroyImmediate(rootObj);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 1. Background
|
|
GameObject bgGo = new GameObject("GazeLab_ParallaxBackground");
|
|
var bg = bgGo.AddComponent<MultilayerParallaxBackground>();
|
|
bg.targetCamera = mainCam;
|
|
|
|
// 2. Space Station at Bottom Middle of the Screen
|
|
GameObject stGo = new GameObject("GazeLab_SpaceStation");
|
|
stGo.transform.position = new Vector3(0f, -3.55f, 0f);
|
|
var stSr = stGo.AddComponent<SpriteRenderer>();
|
|
stSr.sprite = stationLevels[0].stationSprite;
|
|
stSr.sortingOrder = 8;
|
|
var stDmg = stGo.AddComponent<DamageableEntity>();
|
|
var stationCtrl = stGo.AddComponent<SpaceStationController>();
|
|
stationCtrl.levelDefinitions = stationLevels;
|
|
stationCtrl.startingPrimaryWeapon = startingWeapon;
|
|
stationCtrl.rootPurchaseableWeapons = rootWeapons;
|
|
stationCtrl.abilityDefinitions = abilities;
|
|
stationCtrl.stationHullRenderer = stSr;
|
|
stationCtrl.stationDamageable = stDmg;
|
|
|
|
// 3. Core Systems (Input + Audio + GameManager)
|
|
GameObject sysGo = new GameObject("GazeLab_Systems");
|
|
var mouseIn = sysGo.AddComponent<MouseAimInput>();
|
|
var tobiiIn = sysGo.AddComponent<TobiiGazeInputAdapter>();
|
|
var keyIn = sysGo.AddComponent<KeyboardAimInput>();
|
|
var inputMgr = sysGo.AddComponent<InputModeManager>();
|
|
inputMgr.mouseInput = mouseIn;
|
|
inputMgr.tobiiInput = tobiiIn;
|
|
inputMgr.keyboardInput = keyIn;
|
|
|
|
var audioCtrl = sysGo.AddComponent<SpaceAudioController>();
|
|
audioCtrl.ambienceLoop = LoadAudioClip("SpaceAmbience.wav");
|
|
audioCtrl.laserShotClip = LoadAudioClip("Laser.wav");
|
|
audioCtrl.rockBreakClip = LoadAudioClip("RockBreak.wav");
|
|
audioCtrl.shipExplosionClip = LoadAudioClip("Breach.wav");
|
|
audioCtrl.menuClickClip = LoadAudioClip("MenuClick.wav");
|
|
audioCtrl.upgradeRepairClip = LoadAudioClip("Repair.wav");
|
|
audioCtrl.waveCompleteClip = LoadAudioClip("Win.wav");
|
|
audioCtrl.bossAlertClip = LoadAudioClip("Alien.wav");
|
|
audioCtrl.gameOverClip = LoadAudioClip("Lose.wav");
|
|
|
|
var gameMgr = sysGo.AddComponent<GazeLabGameManager>();
|
|
gameMgr.waveCatalog = catalog;
|
|
gameMgr.upgradeTreeDefinition = treeDef;
|
|
gameMgr.spaceStation = stationCtrl;
|
|
gameMgr.parallaxBackground = bg;
|
|
gameMgr.welcomeControlTooltip = welcomeTooltip;
|
|
|
|
// 4. UI & HUD
|
|
GameObject uiGo = new GameObject("GazeLab_UI");
|
|
var hud = uiGo.AddComponent<GazeLabHUD>();
|
|
hud.panelContainerSprite = FindSprite("UI_Rectangular_Container_Big");
|
|
hud.buttonBlueSprite = FindSprite("UI_Button_Container_Regular_Blue");
|
|
hud.buttonGreenSprite = FindSprite("UI_Button_Container_Regular_Green");
|
|
hud.buttonOrangeSprite = FindSprite("UI_Button_Container_Regular_Orange");
|
|
hud.roundSlotCyanSprite = FindSprite("UI_Container_Round_Cyan");
|
|
hud.reticleSprite = FindSprite("UI_Icon_Reticle_Big");
|
|
hud.aimRingSprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/GazeLab/Props/UI/AimRing.png") ?? FindSprite("AimRing");
|
|
hud.scrapIconSprite = FindSprite("UI_Icon_Ressource_Scrap");
|
|
hud.goldIconSprite = FindSprite("UI_Icon_Ressource_Gold");
|
|
hud.uraniumIconSprite = FindSprite("UI_Icon_Ressource_Uranium");
|
|
hud.levelUpIconSprite = FindSprite("UI_Icon_LevelUP");
|
|
hud.settingsIconSprite = FindSprite("UI_Icon_Settings");
|
|
hud.containerSmallSprite = FindSprite("UI_Container_Circular_small_Silver1") ?? FindSprite("UI_Container_Circular_Small_Silver2");
|
|
hud.containerSilverSprite = FindSprite("UI_Container_Circular_Big_Silver1") ?? FindSprite("UI_Container_Circular_Big_Silver2");
|
|
hud.containerGoldSprite = FindSprite("UI_Container_Circular_Elite_Gold1") ?? FindSprite("UI_Container_Circular_Elite_Gold2");
|
|
|
|
EditorSceneManager.MarkSceneDirty(scene);
|
|
EditorSceneManager.SaveScene(scene);
|
|
}
|
|
|
|
// Asset Creation Helpers
|
|
private static CentroidOpacityProfile CreateShieldProfile(
|
|
string fileName,
|
|
string activeSpriteName,
|
|
string rippleSpriteName,
|
|
string brokenSpriteName,
|
|
Vector2 centroid,
|
|
float innerRad,
|
|
float outerRad,
|
|
Color tint)
|
|
{
|
|
var p = LoadOrCreateSo<CentroidOpacityProfile>($"VFX/{fileName}");
|
|
p.activeShieldSprite = FindSprite(activeSpriteName);
|
|
p.previewSprite = p.activeShieldSprite;
|
|
p.hitRippleOverlaySprite = FindSprite(rippleSpriteName);
|
|
p.brokenShieldSprite = FindSprite(brokenSpriteName);
|
|
p.centroidUV = centroid;
|
|
p.innerTransparentRadius = innerRad;
|
|
p.outerRadius = outerRad;
|
|
p.centerOpacityStrength = 0.0f;
|
|
p.rimOpacityStrength = 0.95f;
|
|
p.radialFalloffPower = 1.65f;
|
|
p.darkHaloRemovalThreshold = 0.14f;
|
|
p.darkHaloSoftness = 0.16f;
|
|
p.tintColor = tint;
|
|
p.animateHollowingOverLifetime = false;
|
|
EditorUtility.SetDirty(p);
|
|
return p;
|
|
}
|
|
|
|
private static CentroidOpacityProfile CreateExplosionProfile(
|
|
string fileName,
|
|
string spriteName,
|
|
Color tint)
|
|
{
|
|
var p = LoadOrCreateSo<CentroidOpacityProfile>($"VFX/{fileName}");
|
|
p.previewSprite = FindSprite(spriteName);
|
|
p.centroidUV = new Vector2(0.5f, 0.5f);
|
|
p.innerTransparentRadius = 0.05f;
|
|
p.outerRadius = 0.48f;
|
|
p.centerOpacityStrength = 0.05f;
|
|
p.rimOpacityStrength = 1.0f;
|
|
p.darkHaloRemovalThreshold = 0.14f;
|
|
p.darkHaloSoftness = 0.16f;
|
|
p.tintColor = tint;
|
|
p.animateHollowingOverLifetime = true;
|
|
p.shockwaveStartInnerRadius = 0.0f;
|
|
p.shockwaveEndInnerRadius = 0.42f;
|
|
p.effectDuration = 0.45f;
|
|
EditorUtility.SetDirty(p);
|
|
return p;
|
|
}
|
|
|
|
private static ProjectileDefinition CreateProjectile(
|
|
string fileName,
|
|
string spriteName,
|
|
float angleOffsetDeg,
|
|
TrajectoryType trajectory,
|
|
float speed,
|
|
float damage,
|
|
float shdMult,
|
|
float armMult,
|
|
float hullMult,
|
|
float astMult,
|
|
StatusEffectType status,
|
|
CentroidOpacityProfile expProfile)
|
|
{
|
|
var p = LoadOrCreateSo<ProjectileDefinition>($"Projectiles/{fileName}");
|
|
p.projectileId = fileName.ToLowerInvariant();
|
|
p.projectileSprite = FindSprite(spriteName);
|
|
p.spriteRotationOffsetDeg = angleOffsetDeg;
|
|
p.trajectoryType = trajectory;
|
|
p.speed = speed;
|
|
p.baseDamage = damage;
|
|
p.shieldMultiplier = shdMult;
|
|
p.armorMultiplier = armMult;
|
|
p.hullMultiplier = hullMult;
|
|
p.asteroidMultiplier = astMult;
|
|
p.statusEffect = status;
|
|
p.explosionCentroidProfile = expProfile;
|
|
p.explosionSprite = expProfile != null ? expProfile.previewSprite : null;
|
|
EditorUtility.SetDirty(p);
|
|
return p;
|
|
}
|
|
|
|
private static WeaponDefinition CreateWeapon(
|
|
string fileName,
|
|
string displayName,
|
|
WeaponFamily family,
|
|
int tier,
|
|
string spriteName,
|
|
int barrels,
|
|
FiringPattern pattern,
|
|
float fireRate,
|
|
ProjectileDefinition proj,
|
|
ResourceCost cost,
|
|
params WeaponDefinition[] nextBranches)
|
|
{
|
|
var w = LoadOrCreateSo<WeaponDefinition>($"Weapons/{fileName}");
|
|
w.weaponId = fileName.ToLowerInvariant();
|
|
w.displayName = displayName;
|
|
w.family = family;
|
|
w.tierLevel = tier;
|
|
w.weaponSprite = FindSprite(spriteName);
|
|
w.barrelCount = Mathf.Clamp(barrels, 1, 6);
|
|
w.firingPattern = pattern;
|
|
w.shotsPerSecond = fireRate;
|
|
w.projectile = proj;
|
|
w.purchaseOrUpgradeCost = cost;
|
|
w.nextUpgradeBranches = nextBranches;
|
|
|
|
// Calibrate baseVisualScale and mountPivotOffset automatically from the sprite bounds
|
|
if (w.weaponSprite != null)
|
|
{
|
|
Bounds b = w.weaponSprite.bounds;
|
|
float maxDim = Mathf.Max(1f, b.size.x);
|
|
// Normalize weapon sprite size so massive high-level weapon sprites look proportional on the station!
|
|
w.baseVisualScale = Mathf.Clamp(1.65f / maxDim, 0.12f, 0.42f);
|
|
w.mountPivotOffset = new Vector2(-b.size.x * 0.22f, 0f);
|
|
w.autoBarrelForwardLength = b.size.x * 0.70f;
|
|
w.autoBarrelTotalSpreadY = Mathf.Clamp(b.size.y * 0.36f, 0.25f, 2.2f);
|
|
w.AutoDistributeMuzzleOffsets();
|
|
}
|
|
|
|
EditorUtility.SetDirty(w);
|
|
return w;
|
|
}
|
|
|
|
private static EnemyArchetypeDefinition CreateEnemy(
|
|
string fileName,
|
|
string displayName,
|
|
string subtitle,
|
|
string healthySprite,
|
|
string damagedSprite,
|
|
string brokenSprite,
|
|
float hull,
|
|
bool armored,
|
|
float shield,
|
|
CentroidOpacityProfile shieldProf,
|
|
int harpoonChainsNeeded,
|
|
EnemyStrafePattern strafe,
|
|
float hoverDist,
|
|
float scale,
|
|
EnemyHardpointSlot[] slots,
|
|
ResourceCost drop,
|
|
TutorialTooltipDefinition introTip)
|
|
{
|
|
var e = LoadOrCreateSo<EnemyArchetypeDefinition>($"Enemies/{fileName}");
|
|
e.archetypeId = fileName.ToLowerInvariant();
|
|
e.displayName = displayName;
|
|
e.roleSubtitle = subtitle;
|
|
e.healthySprite = FindSprite(healthySprite);
|
|
e.damagedSprite = FindSprite(damagedSprite);
|
|
e.brokenSprite = FindSprite(brokenSprite);
|
|
e.maxHull = hull;
|
|
e.isArmored = armored;
|
|
e.armorDamageReduction = armored ? 0.38f : 0f;
|
|
e.maxShield = shield;
|
|
e.shieldRegenPerSec = shield > 0f ? 4f : 0f;
|
|
e.shieldProfile = shieldProf;
|
|
e.requiredHarpoonChains = harpoonChainsNeeded;
|
|
e.strafePattern = strafe;
|
|
e.hoverDistance = hoverDist;
|
|
e.baseVisualScale = scale;
|
|
e.hardpoints = slots;
|
|
e.guaranteedDrop = drop;
|
|
e.firstAppearanceTooltip = introTip;
|
|
EditorUtility.SetDirty(e);
|
|
return e;
|
|
}
|
|
|
|
private static TutorialTooltipDefinition CreateTooltip(
|
|
string fileName,
|
|
string header,
|
|
string subTitle,
|
|
string body,
|
|
Sprite icon,
|
|
Color accent)
|
|
{
|
|
var t = LoadOrCreateSo<TutorialTooltipDefinition>($"Tooltips/{fileName}");
|
|
t.tooltipId = fileName.ToLowerInvariant();
|
|
t.headerTitle = header;
|
|
t.subTitle = subTitle;
|
|
t.bodyText = body;
|
|
t.illustrationSprite = icon;
|
|
t.accentColor = accent;
|
|
t.showOncePerSession = true;
|
|
EditorUtility.SetDirty(t);
|
|
return t;
|
|
}
|
|
|
|
private static T LoadOrCreateSo<T>(string relativePath) where T : ScriptableObject
|
|
{
|
|
if (string.IsNullOrWhiteSpace(relativePath))
|
|
{
|
|
relativePath = typeof(T).Name;
|
|
}
|
|
relativePath = relativePath.Trim().TrimEnd('/');
|
|
if (string.IsNullOrWhiteSpace(relativePath) || relativePath.EndsWith("/"))
|
|
{
|
|
relativePath = $"{typeof(T).Name}_{System.Guid.NewGuid().ToString().Substring(0, 8)}";
|
|
}
|
|
string fullPath = $"{BaseSoFolder}/{relativePath}.asset";
|
|
string dir = Path.GetDirectoryName(fullPath);
|
|
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
|
|
{
|
|
Directory.CreateDirectory(dir);
|
|
}
|
|
|
|
T existing = AssetDatabase.LoadAssetAtPath<T>(fullPath);
|
|
if (existing != null) return existing;
|
|
|
|
T created = ScriptableObject.CreateInstance<T>();
|
|
AssetDatabase.CreateAsset(created, fullPath);
|
|
return created;
|
|
}
|
|
|
|
private static void EnsureDirectories()
|
|
{
|
|
string[] dirs =
|
|
{
|
|
BaseSoFolder,
|
|
$"{BaseSoFolder}/VFX",
|
|
$"{BaseSoFolder}/Projectiles",
|
|
$"{BaseSoFolder}/Weapons",
|
|
$"{BaseSoFolder}/Station",
|
|
$"{BaseSoFolder}/Abilities",
|
|
$"{BaseSoFolder}/Enemies",
|
|
$"{BaseSoFolder}/Tooltips",
|
|
$"{BaseSoFolder}/Waves",
|
|
$"{BaseSoFolder}/Upgrades"
|
|
};
|
|
foreach (string d in dirs)
|
|
{
|
|
if (!Directory.Exists(d))
|
|
Directory.CreateDirectory(d);
|
|
}
|
|
}
|
|
|
|
private static void IndexAllGazeLabSprites()
|
|
{
|
|
spriteLookup.Clear();
|
|
string[] guids = AssetDatabase.FindAssets("t:Sprite", new[] { "Assets/GazeLab/Props" });
|
|
foreach (string guid in guids)
|
|
{
|
|
string path = AssetDatabase.GUIDToAssetPath(guid);
|
|
Object[] all = AssetDatabase.LoadAllAssetsAtPath(path);
|
|
foreach (Object obj in all)
|
|
{
|
|
if (obj is Sprite sp && !spriteLookup.ContainsKey(sp.name))
|
|
{
|
|
spriteLookup[sp.name] = sp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static Sprite FindSprite(string spriteName)
|
|
{
|
|
if (string.IsNullOrEmpty(spriteName)) return null;
|
|
if (spriteLookup.TryGetValue(spriteName, out Sprite sp)) return sp;
|
|
foreach (var kv in spriteLookup)
|
|
{
|
|
if (string.Equals(kv.Key, spriteName, System.StringComparison.OrdinalIgnoreCase))
|
|
return kv.Value;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private static Sprite[] FindSprites(params string[] names)
|
|
{
|
|
List<Sprite> list = new List<Sprite>();
|
|
foreach (string n in names)
|
|
{
|
|
Sprite s = FindSprite(n);
|
|
if (s != null) list.Add(s);
|
|
}
|
|
return list.ToArray();
|
|
}
|
|
|
|
private static AudioClip LoadAudioClip(string fileName)
|
|
{
|
|
return AssetDatabase.LoadAssetAtPath<AudioClip>($"Assets/SpaceShooterRoman/Audio/{fileName}");
|
|
}
|
|
|
|
private static WaveDefinitionSO[] BuildAuthoredWaveSOs(
|
|
EnemyArchetypeDefinition violettScout,
|
|
EnemyArchetypeDefinition blueStriker,
|
|
TutorialTooltipDefinition tipWave5)
|
|
{
|
|
List<WaveDefinitionSO> list = new List<WaveDefinitionSO>();
|
|
|
|
// Wave 1
|
|
var w1 = LoadOrCreateSo<WaveDefinitionSO>("Waves/Wave_01");
|
|
w1.waveNumber = 1;
|
|
w1.waveTitle = "Outer Asteroid Drift";
|
|
w1.isBossWave = false;
|
|
w1.normalAsteroidCount = 4;
|
|
w1.resourceAsteroidCount = 3;
|
|
w1.asteroidSpawnInterval = 1.15f;
|
|
w1.guaranteedMinimumYield = new ResourceCost(10, 0, 0);
|
|
w1.enemySpawns = new WaveEnemySpawnEntry[0];
|
|
EditorUtility.SetDirty(w1);
|
|
list.Add(w1);
|
|
|
|
// Wave 2
|
|
var w2 = LoadOrCreateSo<WaveDefinitionSO>("Waves/Wave_02");
|
|
w2.waveNumber = 2;
|
|
w2.waveTitle = "Scrap Field Alpha";
|
|
w2.isBossWave = false;
|
|
w2.normalAsteroidCount = 5;
|
|
w2.resourceAsteroidCount = 4;
|
|
w2.rareUraniumGoldRatio = 0.25f;
|
|
w2.asteroidSpawnInterval = 1.05f;
|
|
w2.guaranteedMinimumYield = new ResourceCost(12, 1, 0);
|
|
w2.enemySpawns = new WaveEnemySpawnEntry[0];
|
|
EditorUtility.SetDirty(w2);
|
|
list.Add(w2);
|
|
|
|
// Wave 3
|
|
var w3 = LoadOrCreateSo<WaveDefinitionSO>("Waves/Wave_03");
|
|
w3.waveNumber = 3;
|
|
w3.waveTitle = "Dense Meteor Shower";
|
|
w3.isBossWave = false;
|
|
w3.normalAsteroidCount = 6;
|
|
w3.resourceAsteroidCount = 4;
|
|
w3.rareUraniumGoldRatio = 0.30f;
|
|
w3.asteroidSpawnInterval = 0.95f;
|
|
w3.guaranteedMinimumYield = new ResourceCost(14, 1, 0);
|
|
w3.enemySpawns = new WaveEnemySpawnEntry[0];
|
|
EditorUtility.SetDirty(w3);
|
|
list.Add(w3);
|
|
|
|
// Wave 4
|
|
var w4 = LoadOrCreateSo<WaveDefinitionSO>("Waves/Wave_04");
|
|
w4.waveNumber = 4;
|
|
w4.waveTitle = "Rich Mineral Cluster";
|
|
w4.isBossWave = false;
|
|
w4.normalAsteroidCount = 6;
|
|
w4.resourceAsteroidCount = 5;
|
|
w4.rareUraniumGoldRatio = 0.35f;
|
|
w4.asteroidSpawnInterval = 0.90f;
|
|
w4.guaranteedMinimumYield = new ResourceCost(16, 2, 0);
|
|
w4.enemySpawns = new WaveEnemySpawnEntry[0];
|
|
EditorUtility.SetDirty(w4);
|
|
list.Add(w4);
|
|
|
|
// Wave 5 Boss
|
|
var w5 = LoadOrCreateSo<WaveDefinitionSO>("Waves/Wave_05");
|
|
w5.waveNumber = 5;
|
|
w5.waveTitle = "Violett Raider Boss";
|
|
w5.isBossWave = true;
|
|
w5.waveStartTooltip = tipWave5;
|
|
w5.normalAsteroidCount = 3;
|
|
w5.resourceAsteroidCount = 3;
|
|
w5.asteroidSpawnInterval = 1.2f;
|
|
w5.guaranteedMinimumYield = new ResourceCost(25, 3, 0);
|
|
w5.enemySpawns = new[]
|
|
{
|
|
new WaveEnemySpawnEntry
|
|
{
|
|
archetype = violettScout,
|
|
spawnCount = 1,
|
|
isWaveBossLead = true,
|
|
roleScaleMultiplier = 1.35f,
|
|
healthMultiplier = 2.4f,
|
|
damageMultiplier = 1.0f,
|
|
initialSpawnDelay = 1.0f,
|
|
spawnInterval = 2f
|
|
},
|
|
new WaveEnemySpawnEntry
|
|
{
|
|
archetype = violettScout,
|
|
spawnCount = 2,
|
|
isWaveBossLead = false,
|
|
roleScaleMultiplier = 0.8f,
|
|
healthMultiplier = 0.8f,
|
|
damageMultiplier = 0.8f,
|
|
initialSpawnDelay = 3.5f,
|
|
spawnInterval = 2.2f
|
|
}
|
|
};
|
|
EditorUtility.SetDirty(w5);
|
|
list.Add(w5);
|
|
|
|
return list.ToArray();
|
|
}
|
|
|
|
[MenuItem("GazeLab/Generate Scene UI Hierarchy (Editable)", priority = 3)]
|
|
public static void GenerateSceneUIHierarchy()
|
|
{
|
|
var hud = Object.FindObjectOfType<GazeLabHUD>();
|
|
if (hud == null)
|
|
{
|
|
Debug.LogWarning("[GazeLabSetupWizard] No GazeLabHUD found in the active scene!");
|
|
return;
|
|
}
|
|
|
|
Undo.RegisterFullObjectHierarchyUndo(hud.gameObject, "Generate Scene UI Hierarchy");
|
|
if (hud.aimRingSprite == null)
|
|
{
|
|
hud.aimRingSprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/GazeLab/Props/UI/AimRing.png");
|
|
}
|
|
hud.BuildCompleteUI();
|
|
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(hud.gameObject.scene);
|
|
Debug.Log("[GazeLabSetupWizard] Generated live GazeLab_MainCanvas hierarchy in the active scene!");
|
|
}
|
|
|
|
[MenuItem("GazeLab/Clear Scene UI Hierarchy", priority = 4)]
|
|
public static void ClearSceneUIHierarchy()
|
|
{
|
|
var hud = Object.FindObjectOfType<GazeLabHUD>();
|
|
if (hud == null) return;
|
|
|
|
Transform canvasTr = hud.transform.Find("GazeLab_MainCanvas");
|
|
if (canvasTr != null)
|
|
{
|
|
Undo.DestroyObjectImmediate(canvasTr.gameObject);
|
|
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(hud.gameObject.scene);
|
|
Debug.Log("[GazeLabSetupWizard] Cleared GazeLab_MainCanvas from the scene hierarchy.");
|
|
}
|
|
}
|
|
|
|
[MenuItem("GazeLab/Rebuild Tech Tree Assets Only", priority = 2)]
|
|
public static void RebuildTechTreeAssetsOnly()
|
|
{
|
|
EnsureDirectories();
|
|
IndexAllGazeLabSprites();
|
|
|
|
List<StationLevelDefinition> stLevels = new List<StationLevelDefinition>();
|
|
for (int i = 1; i <= 8; i++)
|
|
{
|
|
var st = AssetDatabase.LoadAssetAtPath<StationLevelDefinition>($"{BaseSoFolder}/Station/StationLevel_{i}.asset");
|
|
if (st != null) stLevels.Add(st);
|
|
}
|
|
|
|
WeaponDefinition LoadWep(string name) => AssetDatabase.LoadAssetAtPath<WeaponDefinition>($"{BaseSoFolder}/Weapons/{name}.asset");
|
|
StationAbilityDefinition LoadAb(string name) => AssetDatabase.LoadAssetAtPath<StationAbilityDefinition>($"{BaseSoFolder}/Abilities/{name}.asset");
|
|
|
|
var treeDef = BuildUpgradeTreeDefinition(
|
|
stLevels.ToArray(),
|
|
LoadWep("Wep_Phys_Lv1"),
|
|
LoadWep("Wep_Electro_Lv1"),
|
|
LoadWep("Wep_Gauss_Lv1"),
|
|
LoadWep("Wep_Plasma_Lv1"),
|
|
LoadWep("Wep_Wave_Lv1"),
|
|
LoadWep("Wep_Special_RocketLauncher"),
|
|
LoadWep("Wep_Special_Void"),
|
|
LoadAb("Ability_HarpoonGrapple"),
|
|
LoadAb("Ability_EmpShockwave"),
|
|
LoadAb("Ability_AegisOvercharge"),
|
|
LoadAb("Ability_MissileSwarm"));
|
|
|
|
var gm = Object.FindObjectOfType<GazeLabGameManager>();
|
|
if (gm != null)
|
|
{
|
|
gm.upgradeTreeDefinition = treeDef;
|
|
EditorUtility.SetDirty(gm);
|
|
EditorSceneManager.MarkSceneDirty(gm.gameObject.scene);
|
|
}
|
|
|
|
AssetDatabase.SaveAssets();
|
|
AssetDatabase.Refresh();
|
|
Debug.Log("[GazeLabSetupWizard] Rebuilt 22-node 4-track branching Tech Tree assets and linked GazeLabGameManager!");
|
|
}
|
|
|
|
private static UpgradeTreeDefinitionSO BuildUpgradeTreeDefinition(
|
|
StationLevelDefinition[] stationLevels,
|
|
WeaponDefinition wepPhys,
|
|
WeaponDefinition wepElectro,
|
|
WeaponDefinition wepGauss,
|
|
WeaponDefinition wepPlasma,
|
|
WeaponDefinition wepWave,
|
|
WeaponDefinition wepRockets,
|
|
WeaponDefinition wepVoid,
|
|
StationAbilityDefinition abHarpoon,
|
|
StationAbilityDefinition abEmp,
|
|
StationAbilityDefinition abAegis,
|
|
StationAbilityDefinition abSwarm)
|
|
{
|
|
UpgradeTreeDefinitionSO runtimeTree = TechTreeManager.BuildCanonicalBranchingTree(null);
|
|
|
|
// Persist each node as an individual ScriptableObject asset in Upgrades/
|
|
Dictionary<string, UpgradeTreeNodeSO> savedNodesById = new Dictionary<string, UpgradeTreeNodeSO>();
|
|
List<UpgradeTreeNodeSO> persistedNodes = new List<UpgradeTreeNodeSO>();
|
|
|
|
foreach (var memNode in runtimeTree.allNodes)
|
|
{
|
|
if (memNode == null) continue;
|
|
string nodeName = !string.IsNullOrWhiteSpace(memNode.nodeId) ? memNode.nodeId : memNode.name;
|
|
if (string.IsNullOrWhiteSpace(nodeName)) continue;
|
|
var diskNode = LoadOrCreateSo<UpgradeTreeNodeSO>($"Upgrades/{nodeName}");
|
|
CopyNodeFields(memNode, diskNode);
|
|
if (!string.IsNullOrEmpty(diskNode.nodeId))
|
|
savedNodesById[diskNode.nodeId] = diskNode;
|
|
persistedNodes.Add(diskNode);
|
|
}
|
|
|
|
// Re-point prerequisite references to the persisted disk assets
|
|
for (int i = 0; i < runtimeTree.allNodes.Length; i++)
|
|
{
|
|
var memNode = runtimeTree.allNodes[i];
|
|
if (memNode == null || !savedNodesById.TryGetValue(memNode.nodeId, out var diskNode)) continue;
|
|
|
|
if (memNode.prerequisites != null && memNode.prerequisites.Length > 0)
|
|
{
|
|
var diskPrereqs = new TechNodePrerequisite[memNode.prerequisites.Length];
|
|
var legacyParents = new List<UpgradeTreeNodeSO>();
|
|
for (int p = 0; p < memNode.prerequisites.Length; p++)
|
|
{
|
|
var mp = memNode.prerequisites[p];
|
|
UpgradeTreeNodeSO parentAsset = null;
|
|
if (mp.parentNode != null)
|
|
{
|
|
savedNodesById.TryGetValue(mp.parentNode.nodeId, out parentAsset);
|
|
}
|
|
diskPrereqs[p] = new TechNodePrerequisite
|
|
{
|
|
parentNode = parentAsset,
|
|
minRequiredRank = mp.minRequiredRank
|
|
};
|
|
if (parentAsset != null) legacyParents.Add(parentAsset);
|
|
}
|
|
diskNode.prerequisites = diskPrereqs;
|
|
diskNode.prerequisiteNodes = legacyParents.ToArray();
|
|
}
|
|
else
|
|
{
|
|
diskNode.prerequisites = new TechNodePrerequisite[0];
|
|
diskNode.prerequisiteNodes = new UpgradeTreeNodeSO[0];
|
|
}
|
|
|
|
EditorUtility.SetDirty(diskNode);
|
|
}
|
|
|
|
var treeMain = LoadOrCreateSo<UpgradeTreeDefinitionSO>("Upgrades/UpgradeTree_Main");
|
|
treeMain.treeTitle = runtimeTree.treeTitle;
|
|
treeMain.allNodes = persistedNodes.ToArray();
|
|
EditorUtility.SetDirty(treeMain);
|
|
|
|
var treeLegacy = LoadOrCreateSo<UpgradeTreeDefinitionSO>("Upgrades/UpgradeTreeDefinition");
|
|
treeLegacy.treeTitle = runtimeTree.treeTitle;
|
|
treeLegacy.allNodes = persistedNodes.ToArray();
|
|
EditorUtility.SetDirty(treeLegacy);
|
|
|
|
AssetDatabase.SaveAssets();
|
|
return treeMain;
|
|
}
|
|
|
|
private static void CopyNodeFields(UpgradeTreeNodeSO src, UpgradeTreeNodeSO dst)
|
|
{
|
|
dst.nodeId = src.nodeId;
|
|
dst.displayName = src.displayName;
|
|
dst.shortBenefit = src.shortBenefit;
|
|
dst.icon = src.icon;
|
|
dst.branchTrack = src.branchTrack;
|
|
dst.canvasPosition = src.canvasPosition;
|
|
dst.treeTier = src.treeTier;
|
|
dst.columnSlot = src.columnSlot;
|
|
dst.isMajorNode = src.isMajorNode;
|
|
dst.maxRank = src.maxRank;
|
|
dst.baseCost = src.baseCost;
|
|
dst.costIncreasePerRank = src.costIncreasePerRank;
|
|
dst.cost = src.cost;
|
|
dst.statModifierPerRank = src.statModifierPerRank;
|
|
dst.statModifierValue = src.statModifierValue;
|
|
dst.category = src.category;
|
|
dst.unlockedWeapon = src.unlockedWeapon;
|
|
dst.weaponTiersByRank = src.weaponTiersByRank;
|
|
dst.unlockedAbility = src.unlockedAbility;
|
|
dst.statType = src.statType;
|
|
dst.targetStationLevel = src.targetStationLevel;
|
|
dst.requiredWaveCleared = src.requiredWaveCleared;
|
|
dst.requiredWavesByRank = src.requiredWavesByRank;
|
|
dst.isUnlockedByDefault = src.isUnlockedByDefault;
|
|
}
|
|
}
|
|
}
|
|
|