Files
AIGame/AIClient/AgentScripts/BuildLanes.cs
T
udxandClaude Opus 5.5 89e0fa246f Add formal enemies, remaining formal partners and synthesized UI SFX
- UI SFX v3: procedurally synthesized one-shots (Tools/synth_ui_sfx.py) wired to
  buttons, rewards, errors and red dots via UiSfx, gated by the SFX setting.
- Five formal enemies (Hornlet, Dashlet, Shellhorn, HornCaptain, GreatHorn):
  Hunyuan 50k -> 2000-tri XPbr, DGXA TokenRig, Idle/Walk/Attack, nested per type
  in PrototypeArena; PrototypeBattle.Enemy gains presentation-only Moving/Strikes.
- Formal partners for all ten pets in the arena and portraits, including new
  VineSprite, ThunderLeopard and TideWhale.
- Pipeline fixes: reject local TokenRig fallback, drop loose mesh islands,
  configurable Unity run_script timeout, companion static stage.
- Also includes concurrent work from another tool in this working tree
  (FlameLion, enemy combat FX, challenge mode, home explorer, server updates).
- Resources registered in Doc/ResDesc_*.md; verified on isolated :18081.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 12:23:55 +08:00

66 lines
4.1 KiB
C#

using System;
using System.IO;
using System.Linq;
using AIGame.EditorTools;
using UnityEditor;
using UnityEngine;
public static class BuildLanes
{
const string Arena = "Assets/Bundles/Scenes/Prototype/PrototypeArena.prefab";
const string Materials = "Assets/Bundles/Scenes/Prototype/Materials/";
static Transform Group(string name, Transform parent)
{
var existing = parent.Find(name); if (existing != null) return existing;
var go = new GameObject(name); go.layer = 30; go.transform.SetParent(parent, false); return go.transform;
}
static Transform Shape(string name, Transform parent, PrimitiveType primitive, Vector3 position, Vector3 scale, string material)
{
var shape = parent.Find(name);
if (shape == null)
{
var go = GameObject.CreatePrimitive(primitive); go.name = name; go.layer = 30; go.transform.SetParent(parent, false); shape = go.transform;
UnityEngine.Object.DestroyImmediate(go.GetComponent<Collider>());
}
shape.localPosition = position; shape.localScale = scale;
var mat = AssetDatabase.LoadAssetAtPath<Material>(Materials + material + ".mat");
if (mat == null) throw new Exception("Missing material " + material);
shape.GetComponent<Renderer>().sharedMaterial = mat; return shape;
}
public static string Build()
{
if (EditorApplication.isPlaying) throw new Exception("Build lanes in Edit Mode");
string repo = Directory.GetParent(Application.dataPath).Parent.FullName;
foreach (string screen in new[] { "Formation", "Pets", "Battle", "Stages" })
if (string.IsNullOrEmpty(JsonUIPrefabBuilder.BuildFromJsonFile(Path.Combine(repo, "Doc/UIPrefabCreater/UI_Prototype" + screen + ".json")))) throw new Exception("Failed " + screen);
var root = PrefabUtility.LoadPrefabContents(Arena);
try
{
var markers = Group("DeploymentMarkers", root.transform); var effects = Group("SkillEffects", root.transform);
for (int slot = 0; slot < 6; slot++)
Shape("Slot" + slot, markers, PrimitiveType.Cylinder, new Vector3(slot / 2 == 0 ? 0 : slot / 2 == 1 ? -3 : 3, .015f, slot % 2 == 0 ? 0 : -2), new Vector3(1.7f, .025f, 1.7f), "ProtoCream");
string[] colors = { "ProtoCyan", "ProtoOrange", "ProtoLeaf", "ProtoYellow", "ProtoWater", "ProtoRock", "ProtoEmber", "ProtoGrass", "ProtoViolet", "ProtoCyan" };
for (int i = 0; i < 10; i++)
{
Shape("Skill" + i, effects, PrimitiveType.Cylinder, Vector3.zero, new Vector3(1.5f, .04f, 1.5f), colors[i]).gameObject.SetActive(false);
Shape("Shield" + i, effects, PrimitiveType.Cylinder, Vector3.zero, new Vector3(1.9f, .06f, 1.9f), "ProtoCyan").gameObject.SetActive(false);
var hero = root.transform.Find("Heroes/Hero" + i);
// Formal partners (nested "Visual") are 1.5 units tall; primitive stand-ins reach ~1.8.
var crest = Shape("T2Crest", hero, PrimitiveType.Cube, new Vector3(0, hero.Find("Visual") != null ? 1.8f : 2.0f, 0), Vector3.one * .24f, "ProtoYellow");
crest.localRotation = Quaternion.Euler(0, 45, 45); crest.gameObject.SetActive(false);
}
for (int i = 0; i < 9; i++)
{
var mark = root.transform.Find("Enemies/Enemy" + i);
var slow = Shape("SlowMark", mark, PrimitiveType.Cylinder, new Vector3(0, .015f, 0), new Vector3(1.1f, .03f, 1.1f), "ProtoWater"); slow.gameObject.SetActive(false);
}
foreach (Transform child in root.transform.Cast<Transform>().Where(t => t.name == "Lane" || t.name.StartsWith("LaneRoad")))
child.GetComponent<Renderer>().sharedMaterial = AssetDatabase.LoadAssetAtPath<Material>(Materials + "ProtoPath.mat");
PrefabUtility.SaveAsPrefabAsset(root, Arena);
}
finally { PrefabUtility.UnloadPrefabContents(root); }
SetupUiBundleCollector.Setup(); AssetDatabase.SaveAssets();
return "Built four Candy pages, authored drag handles/ghost, three-lane markers, ten skill/shield slots and T2 crests.";
}
}