какашки мне в кармашки
This commit is contained in:
1 parent
7fba61f7a0
commit
cbda26dfc0
335 files changed
+51926
-7266
No files matched your search
@@ -157,6 +157,13 @@ public static class CharacterSetup
|
||||
EditorUtility.SetDirty(echo);
|
||||
}
|
||||
|
||||
var ph = player.GetComponent<PlayerHealth>();
|
||||
if (ph != null)
|
||||
{
|
||||
ph.playerAnimator = animator;
|
||||
EditorUtility.SetDirty(ph);
|
||||
}
|
||||
|
||||
// 9. Проверяем CameraFollow на главной камере
|
||||
if (Camera.main != null)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public static class CosmicRetroLabIntegrator
|
||||
{
|
||||
private const string ROOT_NAME = "Cosmic_Retro_Laboratory";
|
||||
private const string PROPS_DIR = "Assets/room/Cosmic_Retro_Laboratory_2_Demo/Prefabs/Props/";
|
||||
|
||||
private static GameObject deskPrefab;
|
||||
private static GameObject compPrefab;
|
||||
private static GameObject microPrefab;
|
||||
private static GameObject notePrefab;
|
||||
private static GameObject stoolPrefab;
|
||||
private static GameObject capsulePrefab;
|
||||
private static GameObject alienPrefab;
|
||||
|
||||
[MenuItem("Tools/Integrate Cosmic Retro Laboratory")]
|
||||
public static void Integrate()
|
||||
{
|
||||
LoadPrefabs();
|
||||
|
||||
// 1. Найти или очистить предыдущую интеграцию
|
||||
var existingRoot = GameObject.Find(ROOT_NAME);
|
||||
if (existingRoot != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(existingRoot);
|
||||
}
|
||||
|
||||
var rootGo = new GameObject(ROOT_NAME);
|
||||
Undo.RegisterCreatedObjectUndo(rootGo, "Integrate Cosmic Retro Lab");
|
||||
|
||||
// 2. Интеграция по секторам исследовательского комплекса
|
||||
BuildAirlockSector(rootGo.transform);
|
||||
BuildSouthConcourseSector(rootGo.transform);
|
||||
BuildGrandAtriumSector(rootGo.transform);
|
||||
BuildBiochemLabSector(rootGo.transform);
|
||||
BuildGeneticsWingSector(rootGo.transform);
|
||||
BuildCryoVaultSector(rootGo.transform);
|
||||
BuildSurgicalSector(rootGo.transform);
|
||||
BuildQuarantineSector(rootGo.transform);
|
||||
|
||||
// 3. Обновить список материалов эхолокации в EchoTrigger (если компонент в сцене)
|
||||
var echoTrigger = Object.FindAnyObjectByType<EchoTrigger>();
|
||||
if (echoTrigger != null)
|
||||
{
|
||||
echoTrigger.CollectAllEchoMaterials();
|
||||
EditorUtility.SetDirty(echoTrigger);
|
||||
}
|
||||
|
||||
// 4. Сохранить изменения в открытой сцене и синхронизировать с SampleScene.unity
|
||||
var activeScene = SceneManager.GetActiveScene();
|
||||
EditorSceneManager.MarkSceneDirty(activeScene);
|
||||
EditorSceneManager.SaveScene(activeScene);
|
||||
|
||||
string sampleScenePath = "Assets/Scenes/SampleScene.unity";
|
||||
if (activeScene.path != sampleScenePath)
|
||||
{
|
||||
EditorSceneManager.SaveScene(activeScene, sampleScenePath, true);
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
Debug.Log($"[CosmicRetroLabIntegrator] Успешно интегрировано 73 объекта Cosmic Retro Laboratory в сцену '{activeScene.name}' ({activeScene.path}) и сохранено в '{sampleScenePath}'!");
|
||||
}
|
||||
|
||||
private static void LoadPrefabs()
|
||||
{
|
||||
deskPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Desk_01.prefab");
|
||||
compPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Computer_01.prefab");
|
||||
microPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Microscope.prefab");
|
||||
notePrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Notebook.prefab");
|
||||
stoolPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Stool.prefab");
|
||||
capsulePrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Capsule_01.prefab");
|
||||
alienPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(PROPS_DIR + "CR_Lab2_Alien_01.prefab");
|
||||
|
||||
if (deskPrefab == null || compPrefab == null || capsulePrefab == null || alienPrefab == null)
|
||||
{
|
||||
throw new System.Exception("Не удалось загрузить один или несколько префабов Cosmic Retro!");
|
||||
}
|
||||
}
|
||||
|
||||
// --- СЕКТОР 1: Входной шлюз / Точка появления игрока (Spawn: 0, 1.05, -44) ---
|
||||
private static void BuildAirlockSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "01_Airlock_Spawn");
|
||||
|
||||
// Приемный терминал службы безопасности (справа от игрока, экран виден при движении на север)
|
||||
SpawnWorkstation(sector, new Vector3(3.2f, 0.0f, -42.5f), -90f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Security_Console");
|
||||
|
||||
// Первая капсула со спящим пришельцем у шлюза
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(3.2f, 0.0f, -45.0f), Quaternion.Euler(0, -45f, 0), "Airlock_Stasis_Capsule");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 2: Южный переходной коридор (Z ~ -30) ---
|
||||
private static void BuildSouthConcourseSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "02_SouthConcourse");
|
||||
|
||||
// Наблюдательный терминал коридора
|
||||
SpawnWorkstation(sector, new Vector3(-4.5f, 0.0f, -29.5f), 0f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Concourse_Terminal");
|
||||
|
||||
// Капсула с биологическим образцом в восточной нише
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(4.5f, 0.0f, -29.5f), Quaternion.Euler(0, 180f, 0), "Concourse_Specimen_Pod");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 3: Главный Атриум / Центральный исследовательский хаб ---
|
||||
private static void BuildGrandAtriumSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "03_GrandAtrium");
|
||||
|
||||
// Двойной центральный пост мониторинга
|
||||
SpawnWorkstation(sector, new Vector3(-3.0f, 0.0f, 3.0f), 45f,
|
||||
withComputer: true, withMicroscope: true, withNotebook: true, withStool: true, "Atrium_Command_Station_Alpha");
|
||||
|
||||
SpawnWorkstation(sector, new Vector3(3.0f, 0.0f, 3.0f), -45f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Atrium_Command_Station_Beta");
|
||||
|
||||
// Парные стазис-капсулы в центре атриума
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-5.0f, 0.0f, 7.5f), Quaternion.Euler(0, 45f, 0), "Atrium_Containment_Pod_Left");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(5.0f, 0.0f, 7.5f), Quaternion.Euler(0, -45f, 0), "Atrium_Containment_Pod_Right");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 4: Биохимическая лаборатория (Сектор D, X ~ -40, Z ~ -10) ---
|
||||
private static void BuildBiochemLabSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "04_BiochemistryLab");
|
||||
|
||||
// Исследовательский пост биохимического синтеза (микроскоп, компьютер, блокнот)
|
||||
SpawnWorkstation(sector, new Vector3(-38.0f, 0.0f, -6.5f), 90f,
|
||||
withComputer: true, withMicroscope: true, withNotebook: true, withStool: true, "Biochem_Analysis_Desk_01");
|
||||
|
||||
// Вспомогательный рабочий стол анализа проб
|
||||
SpawnWorkstation(sector, new Vector3(-38.0f, 0.0f, -13.5f), 90f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Biochem_Analysis_Desk_02");
|
||||
|
||||
// Биохимические инкубаторы с пришельцами
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-43.0f, 0.0f, -6.5f), Quaternion.Euler(0, 135f, 0), "Biochem_Incubator_01");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-43.0f, 0.0f, -13.5f), Quaternion.Euler(0, 45f, 0), "Biochem_Incubator_02");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 5: Отсек генетики и мутагенеза (Сектор G, X ~ +39, Z ~ +15) ---
|
||||
private static void BuildGeneticsWingSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "05_GeneticsWing");
|
||||
|
||||
// Рабочее место генного инженера
|
||||
SpawnWorkstation(sector, new Vector3(36.0f, 0.0f, 15.5f), 90f,
|
||||
withComputer: true, withMicroscope: true, withNotebook: true, withStool: true, "Genetics_Console");
|
||||
|
||||
// Тройная шеренга генетических инкубационных капсул
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(42.5f, 0.0f, 13.5f), Quaternion.Euler(0, -90f, 0), "Genetics_Incubator_Pod_1");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(42.5f, 0.0f, 15.8f), Quaternion.Euler(0, -90f, 0), "Genetics_Incubator_Pod_2");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(42.5f, 0.0f, 18.0f), Quaternion.Euler(0, -90f, 0), "Genetics_Incubator_Pod_3");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 6: Криогенное хранилище / Стазис-сектор (Сектор B, X ~ -36, Z ~ -37) ---
|
||||
private static void BuildCryoVaultSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "06_CryoVault");
|
||||
|
||||
// Главный пульт криогенного управления
|
||||
SpawnWorkstation(sector, new Vector3(-36.5f, 0.0f, -33.5f), 180f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Cryo_Master_Terminal");
|
||||
|
||||
// Банк из четырех крио-капсул глубокой заморозки
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-33.0f, 0.0f, -41.0f), Quaternion.identity, "Cryo_Stasis_Tank_01");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-35.5f, 0.0f, -41.0f), Quaternion.identity, "Cryo_Stasis_Tank_02");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-38.0f, 0.0f, -41.0f), Quaternion.identity, "Cryo_Stasis_Tank_03");
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-40.5f, 0.0f, -41.0f), Quaternion.identity, "Cryo_Stasis_Tank_04");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 7: Хирургический бокс / Медблок (Сектор E, X ~ +39, Z ~ -10) ---
|
||||
private static void BuildSurgicalSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "07_SurgicalTheatre");
|
||||
|
||||
// Диагностический пост хирурга
|
||||
SpawnWorkstation(sector, new Vector3(36.5f, 0.0f, -9.5f), 90f,
|
||||
withComputer: true, withMicroscope: true, withNotebook: true, withStool: true, "Surgical_Diagnostics_Desk");
|
||||
|
||||
// Изолированная капсула для автопсий и исследований
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(43.0f, 0.0f, -9.5f), Quaternion.Euler(0, -90f, 0), "Surgical_Stasis_Pod");
|
||||
}
|
||||
|
||||
// --- СЕКТОР 8: Карантинный изолятор (Сектор C, X ~ -35, Z ~ +16) ---
|
||||
private static void BuildQuarantineSector(Transform parent)
|
||||
{
|
||||
var sector = CreateSector(parent, "08_QuarantineBay");
|
||||
|
||||
// Пост наблюдения за карантинным блоком
|
||||
SpawnWorkstation(sector, new Vector3(-32.0f, 0.0f, 16.0f), -90f,
|
||||
withComputer: true, withMicroscope: false, withNotebook: true, withStool: true, "Quarantine_Observation_Desk");
|
||||
|
||||
// Высокозащищенная капсула изоляции
|
||||
SpawnCapsuleWithAlien(sector, new Vector3(-39.0f, 0.0f, 16.0f), Quaternion.Euler(0, 90f, 0), "BioHazard_Isolation_Pod");
|
||||
}
|
||||
|
||||
// --- ХЕЛПЕРЫ ДЛЯ СПАВНА И ПОЗИЦИОНИРОВАНИЯ ---
|
||||
private static Transform CreateSector(Transform parent, string name)
|
||||
{
|
||||
var go = new GameObject(name);
|
||||
go.transform.SetParent(parent, false);
|
||||
return go.transform;
|
||||
}
|
||||
|
||||
private static void SpawnCapsuleWithAlien(Transform parent, Vector3 pos, Quaternion rot, string name)
|
||||
{
|
||||
var capsule = (GameObject)PrefabUtility.InstantiatePrefab(capsulePrefab);
|
||||
capsule.name = name;
|
||||
capsule.transform.SetParent(parent, false);
|
||||
capsule.transform.position = pos;
|
||||
capsule.transform.rotation = rot;
|
||||
|
||||
// Пришелец размещается ровно внутри капсулы на высоте 0.92 м
|
||||
var alien = (GameObject)PrefabUtility.InstantiatePrefab(alienPrefab);
|
||||
alien.name = "Specimen_" + name;
|
||||
alien.transform.SetParent(capsule.transform, false);
|
||||
alien.transform.localPosition = new Vector3(0.0f, 0.92f, 0.0f);
|
||||
alien.transform.localRotation = Quaternion.identity;
|
||||
|
||||
// Отключаем прямой коллайдер пришельца, чтобы он не конфликтовал со стеклянной оболочкой капсулы
|
||||
var col = alien.GetComponent<Collider>();
|
||||
if (col != null) col.enabled = false;
|
||||
}
|
||||
|
||||
private static void SpawnWorkstation(Transform parent, Vector3 deskPos, float rotY,
|
||||
bool withComputer, bool withMicroscope, bool withNotebook, bool withStool, string stationName)
|
||||
{
|
||||
var station = new GameObject(stationName);
|
||||
station.transform.SetParent(parent, false);
|
||||
station.transform.position = deskPos;
|
||||
station.transform.rotation = Quaternion.Euler(0f, rotY, 0f);
|
||||
|
||||
// Стол
|
||||
var desk = (GameObject)PrefabUtility.InstantiatePrefab(deskPrefab);
|
||||
desk.name = "Desk";
|
||||
desk.transform.SetParent(station.transform, false);
|
||||
desk.transform.localPosition = Vector3.zero;
|
||||
desk.transform.localRotation = Quaternion.identity;
|
||||
|
||||
// Компьютер (слева на столе, высота поверхности стола = 0.81м)
|
||||
if (withComputer)
|
||||
{
|
||||
var comp = (GameObject)PrefabUtility.InstantiatePrefab(compPrefab);
|
||||
comp.name = "Computer_Terminal";
|
||||
comp.transform.SetParent(station.transform, false);
|
||||
comp.transform.localPosition = new Vector3(-0.35f, 0.81f, 0.05f);
|
||||
comp.transform.localRotation = Quaternion.identity;
|
||||
}
|
||||
|
||||
// Микроскоп (справа на столе)
|
||||
if (withMicroscope)
|
||||
{
|
||||
var micro = (GameObject)PrefabUtility.InstantiatePrefab(microPrefab);
|
||||
micro.name = "Research_Microscope";
|
||||
micro.transform.SetParent(station.transform, false);
|
||||
micro.transform.localPosition = new Vector3(0.38f, 0.81f, 0.08f);
|
||||
micro.transform.localRotation = Quaternion.Euler(0f, -15f, 0f);
|
||||
}
|
||||
|
||||
// Блокнот / Журнал наблюдений (по центру/справа перед исследователем)
|
||||
if (withNotebook)
|
||||
{
|
||||
var note = (GameObject)PrefabUtility.InstantiatePrefab(notePrefab);
|
||||
note.name = "Lab_Notebook";
|
||||
note.transform.SetParent(station.transform, false);
|
||||
float noteX = withMicroscope ? 0.20f : 0.30f;
|
||||
note.transform.localPosition = new Vector3(noteX, 0.81f, -0.15f);
|
||||
note.transform.localRotation = Quaternion.Euler(0f, 12f, 0f);
|
||||
}
|
||||
|
||||
// Табурет перед столом
|
||||
if (withStool)
|
||||
{
|
||||
var stool = (GameObject)PrefabUtility.InstantiatePrefab(stoolPrefab);
|
||||
stool.name = "Swivel_Stool";
|
||||
stool.transform.SetParent(station.transform, false);
|
||||
stool.transform.localPosition = new Vector3(0.0f, 0.0f, -0.75f);
|
||||
stool.transform.localRotation = Quaternion.Euler(0f, 25f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1e48e3d2f493a74ebf84e4714e772a8
|
||||
@@ -0,0 +1,231 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
public static class DeathScreenBuilder
|
||||
{
|
||||
private static Font standardFont;
|
||||
private static DefaultControls.Resources uiResources;
|
||||
|
||||
[MenuItem("Tools/Build Death Screen In Scene")]
|
||||
public static string Build()
|
||||
{
|
||||
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (standardFont == null)
|
||||
standardFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
uiResources = new DefaultControls.Resources();
|
||||
|
||||
// 1. Находим PauseCanvas или Canvas в сцене
|
||||
GameObject canvasGo = GameObject.Find("PauseCanvas");
|
||||
if (canvasGo == null)
|
||||
{
|
||||
canvasGo = GameObject.Find("Canvas");
|
||||
}
|
||||
|
||||
if (canvasGo == null)
|
||||
{
|
||||
// Создаем новый Canvas
|
||||
canvasGo = new GameObject("DeathCanvas");
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvas.sortingOrder = 100;
|
||||
|
||||
CanvasScaler scaler = canvasGo.AddComponent<CanvasScaler>();
|
||||
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
||||
scaler.referenceResolution = new Vector2(1920, 1080);
|
||||
scaler.matchWidthOrHeight = 0.5f;
|
||||
|
||||
canvasGo.AddComponent<GraphicRaycaster>();
|
||||
}
|
||||
|
||||
Undo.RegisterFullObjectHierarchyUndo(canvasGo, "Build Death Screen");
|
||||
|
||||
// Удаляем старый DeathScreenPanel, если был
|
||||
Transform oldPanel = canvasGo.transform.Find("DeathScreenPanel");
|
||||
if (oldPanel != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldPanel.gameObject);
|
||||
}
|
||||
|
||||
// 2. Создаем фоновую панель затемнения (DeathScreenPanel)
|
||||
GameObject deathPanel = CreateImage("DeathScreenPanel", canvasGo.transform,
|
||||
new Color(0.05f, 0.01f, 0.015f, 0.92f), // Глубокий темно-бордовый фон
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
CanvasGroup cg = deathPanel.AddComponent<CanvasGroup>();
|
||||
cg.alpha = 1f;
|
||||
|
||||
// 3. Центральная карточка (Death_Card)
|
||||
GameObject card = CreateImage("Death_Card", deathPanel.transform,
|
||||
new Color(0.10f, 0.03f, 0.045f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(520f, 440f), Vector2.zero);
|
||||
|
||||
// Кроваво-красная светящаяся рамка
|
||||
Outline outline = card.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(0.95f, 0.15f, 0.20f, 0.70f);
|
||||
outline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
Shadow shadow = card.AddComponent<Shadow>();
|
||||
shadow.effectColor = new Color(0.5f, 0.0f, 0.05f, 0.5f);
|
||||
shadow.effectDistance = new Vector2(6f, -6f);
|
||||
|
||||
// 4. Заголовок "ВЫ ПОГИБЛИ"
|
||||
CreateText("Death_Title", card.transform,
|
||||
"ВЫ ПОГИБЛИ",
|
||||
40, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(1f, 0.22f, 0.22f, 1f),
|
||||
new Vector2(0.05f, 0.76f), new Vector2(0.95f, 0.95f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Разделительная линия
|
||||
CreateImage("Death_Divider", card.transform,
|
||||
new Color(0.95f, 0.20f, 0.25f, 0.55f),
|
||||
new Vector2(0.12f, 0.74f), new Vector2(0.88f, 0.745f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Подзаголовок
|
||||
CreateText("Death_Subtitle", card.transform,
|
||||
"Биометрические показатели на нуле.\nСвязь с комплексом потеряна.",
|
||||
16, FontStyle.Normal, TextAnchor.MiddleCenter,
|
||||
new Color(0.90f, 0.78f, 0.80f, 0.90f),
|
||||
new Vector2(0.08f, 0.58f), new Vector2(0.92f, 0.72f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// 5. Контейнер кнопок
|
||||
GameObject btnContainer = CreateEmptyRect("Buttons_Container", card.transform,
|
||||
new Vector2(0.10f, 0.08f), new Vector2(0.90f, 0.54f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup vLayout = btnContainer.AddComponent<VerticalLayoutGroup>();
|
||||
vLayout.spacing = 16f;
|
||||
vLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
vLayout.childControlWidth = true;
|
||||
vLayout.childControlHeight = false;
|
||||
vLayout.childForceExpandWidth = true;
|
||||
vLayout.childForceExpandHeight = false;
|
||||
|
||||
// Кнопка "Начать заново"
|
||||
Button restartBtn = CreateStyledButton("Btn_Restart", btnContainer.transform,
|
||||
"↺ НАЧАТЬ ЗАНОВО",
|
||||
new Color(0.38f, 0.08f, 0.10f, 0.95f),
|
||||
new Color(0.85f, 0.16f, 0.20f, 1.0f),
|
||||
new Color(0.22f, 0.04f, 0.05f, 1.0f),
|
||||
Color.white, 54f, 20);
|
||||
|
||||
// Кнопка "Главное меню"
|
||||
Button mainMenuBtn = CreateStyledButton("Btn_MainMenu", btnContainer.transform,
|
||||
"⮌ ГЛАВНОЕ МЕНЮ",
|
||||
new Color(0.18f, 0.18f, 0.22f, 0.95f),
|
||||
new Color(0.36f, 0.36f, 0.42f, 1.0f),
|
||||
new Color(0.10f, 0.10f, 0.12f, 1.0f),
|
||||
new Color(0.9f, 0.9f, 0.9f, 1f), 50f, 18);
|
||||
|
||||
// 6. Настраиваем компонент DeathScreenUI
|
||||
DeathScreenUI deathUI = canvasGo.GetComponent<DeathScreenUI>();
|
||||
if (deathUI == null)
|
||||
deathUI = canvasGo.AddComponent<DeathScreenUI>();
|
||||
|
||||
deathUI.deathPanel = deathPanel;
|
||||
deathUI.canvasGroup = cg;
|
||||
deathUI.restartButton = restartBtn;
|
||||
deathUI.mainMenuButton = mainMenuBtn;
|
||||
deathUI.fadeDuration = 0.8f;
|
||||
deathUI.mainMenuSceneName = "MainMenu";
|
||||
|
||||
// По умолчанию скрываем панель смерти
|
||||
deathPanel.SetActive(false);
|
||||
|
||||
// 7. Привязываем к игроку (PlayerHealth)
|
||||
GameObject player = GameObject.Find("Player");
|
||||
if (player == null) player = GameObject.Find("Capsule");
|
||||
if (player != null)
|
||||
{
|
||||
var ph = player.GetComponent<PlayerHealth>();
|
||||
if (ph != null)
|
||||
{
|
||||
ph.deathScreenUI = deathUI;
|
||||
EditorUtility.SetDirty(ph);
|
||||
}
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(deathUI);
|
||||
EditorUtility.SetDirty(canvasGo);
|
||||
EditorSceneManager.MarkSceneDirty(canvasGo.scene);
|
||||
EditorSceneManager.SaveScene(canvasGo.scene);
|
||||
|
||||
Debug.Log("<color=green>[DeathScreenBuilder] Экран смерти успешно собран и настроен в сцене!</color>");
|
||||
return "SUCCESS: Death screen successfully built and configured in scene!";
|
||||
}
|
||||
|
||||
private static GameObject CreateImage(string name, Transform parent, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Image img = go.AddComponent<Image>();
|
||||
img.color = color;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static GameObject CreateEmptyRect(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
GameObject go = new GameObject(name);
|
||||
go.transform.SetParent(parent, false);
|
||||
RectTransform rt = go.AddComponent<RectTransform>();
|
||||
rt.anchorMin = anchorMin;
|
||||
rt.anchorMax = anchorMax;
|
||||
rt.sizeDelta = sizeDelta;
|
||||
rt.anchoredPosition = anchoredPosition;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static GameObject CreateText(string name, Transform parent, string text, int fontSize, FontStyle style, TextAnchor alignment, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
t.text = text;
|
||||
t.fontSize = fontSize;
|
||||
t.fontStyle = style;
|
||||
t.alignment = alignment;
|
||||
t.color = color;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
t.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static Button CreateStyledButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
||||
{
|
||||
GameObject btnObj = DefaultControls.CreateButton(uiResources);
|
||||
btnObj.name = name;
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
LayoutElement layout = btnObj.AddComponent<LayoutElement>();
|
||||
layout.minHeight = height;
|
||||
layout.preferredHeight = height;
|
||||
|
||||
Image img = btnObj.GetComponent<Image>();
|
||||
img.color = normalColor;
|
||||
img.type = Image.Type.Sliced;
|
||||
|
||||
Button btn = btnObj.GetComponent<Button>();
|
||||
ColorBlock colors = btn.colors;
|
||||
colors.normalColor = normalColor;
|
||||
colors.highlightedColor = highlightedColor;
|
||||
colors.pressedColor = pressedColor;
|
||||
colors.selectedColor = highlightedColor;
|
||||
colors.colorMultiplier = 1f;
|
||||
colors.fadeDuration = 0.12f;
|
||||
btn.colors = colors;
|
||||
|
||||
Text text = btnObj.GetComponentInChildren<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
text.font = standardFont;
|
||||
text.text = label;
|
||||
text.fontSize = fontSize;
|
||||
text.fontStyle = FontStyle.Bold;
|
||||
text.color = textColor;
|
||||
text.alignment = TextAnchor.MiddleCenter;
|
||||
}
|
||||
|
||||
return btn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31483bf80058f51428d4c69cdb8e570d
|
||||
@@ -235,6 +235,17 @@ public static class LaboratoryLevelGenerator
|
||||
if (enemy == null) enemy = Object.FindAnyObjectByType<BlindMutantAI>()?.gameObject;
|
||||
SetupPatrolWaypoints(labRoot.transform, enemy);
|
||||
|
||||
// Apply EchoCloudMat to all generated props and objects under labRoot
|
||||
if (echoMat != null)
|
||||
{
|
||||
foreach (var r in labRoot.GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
var mats = new Material[r.sharedMaterials.Length];
|
||||
for (int i = 0; i < mats.Length; i++) mats[i] = echoMat;
|
||||
r.sharedMaterials = mats;
|
||||
}
|
||||
}
|
||||
|
||||
// 11. Re-bake NavMesh Surface for entire 100x100m facility
|
||||
var navMeshSurface = Object.FindAnyObjectByType<NavMeshSurface>();
|
||||
if (navMeshSurface != null)
|
||||
@@ -245,6 +256,9 @@ public static class LaboratoryLevelGenerator
|
||||
Debug.Log("<color=green>NavMesh successfully baked for the 100x100m complex facility!</color>");
|
||||
}
|
||||
|
||||
// 12. Populate All Sectors and Rooms with Mutants (Roamers, Heavy Swarms, and Room Guards)
|
||||
MutantPopulationSetup.Populate();
|
||||
|
||||
// Mark scene dirty
|
||||
EditorUtility.SetDirty(labRoot);
|
||||
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
|
||||
|
||||
@@ -12,11 +12,23 @@ public static class MainMenuSceneBuilder
|
||||
{
|
||||
private static DefaultControls.Resources uiResources;
|
||||
private static Font standardFont;
|
||||
private static Font handwrittenFont;
|
||||
|
||||
[MenuItem("Tools/Build Main Menu Scene")]
|
||||
public static string BuildScene()
|
||||
{
|
||||
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (standardFont == null)
|
||||
standardFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
// Загрузка рукописного шрифта для названия Synthesia
|
||||
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/SegoeScriptBold.ttf");
|
||||
if (handwrittenFont == null)
|
||||
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
||||
if (handwrittenFont == null)
|
||||
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/MonotypeCorsiva.ttf");
|
||||
if (handwrittenFont == null)
|
||||
handwrittenFont = standardFont;
|
||||
|
||||
uiResources = new DefaultControls.Resources
|
||||
{
|
||||
@@ -31,11 +43,11 @@ public static class MainMenuSceneBuilder
|
||||
// Создаем новую пустую сцену
|
||||
Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
||||
|
||||
// 1. Камера
|
||||
// 1. Камера (Абсолютно черный фон)
|
||||
GameObject camGo = new GameObject("Main Camera");
|
||||
Camera cam = camGo.AddComponent<Camera>();
|
||||
cam.clearFlags = CameraClearFlags.SolidColor;
|
||||
cam.backgroundColor = new Color(0.035f, 0.05f, 0.075f, 1f);
|
||||
cam.backgroundColor = Color.black;
|
||||
camGo.AddComponent<UniversalAdditionalCameraData>();
|
||||
camGo.AddComponent<AudioListener>();
|
||||
camGo.tag = "MainCamera";
|
||||
@@ -46,7 +58,7 @@ public static class MainMenuSceneBuilder
|
||||
eventSysGo.AddComponent<EventSystem>();
|
||||
eventSysGo.AddComponent<InputSystemUIInputModule>();
|
||||
|
||||
// 3. Canvas
|
||||
// 3. Canvas (1920x1080)
|
||||
GameObject canvasGo = new GameObject("Canvas");
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
@@ -64,118 +76,164 @@ public static class MainMenuSceneBuilder
|
||||
GameObject managerGo = new GameObject("MainMenuManager");
|
||||
MainMenuManager manager = managerGo.AddComponent<MainMenuManager>();
|
||||
|
||||
// 5. Задний фон Canvas
|
||||
CreateImage("Background_Dark", canvasGo.transform,
|
||||
new Color(0.025f, 0.04f, 0.065f, 1f),
|
||||
// 5. Задний фон: Чистый глубокий черный цвет
|
||||
CreateImage("Background_Black", canvasGo.transform,
|
||||
Color.black,
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Декоративная подложка с мягким сине-зеленым свечением
|
||||
CreateImage("Decor_Tint", canvasGo.transform,
|
||||
new Color(0.00f, 0.45f, 0.60f, 0.06f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
// ==========================================
|
||||
// 6. АНИМИРОВАННЫЕ ЖЕЛТЫЕ ВОЛНЫ ЭХОЛОКАЦИИ В ПРАВОМ НИЖНЕМ УГЛУ
|
||||
// ==========================================
|
||||
GameObject radarRoot = CreateEmptyRect("Corner_Echolocation_Radar", canvasGo.transform,
|
||||
new Vector2(1f, 0f), new Vector2(1f, 0f),
|
||||
new Vector2(280f, 280f), new Vector2(-140f, 140f));
|
||||
|
||||
// Декоративная неоновая полоса слева
|
||||
CreateImage("AccentLine_Left", canvasGo.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.70f),
|
||||
new Vector2(0f, 0f), new Vector2(0f, 1f),
|
||||
new Vector2(6f, 0f), new Vector2(3f, 0f));
|
||||
MenuEcholocationRadar echoRadar = radarRoot.AddComponent<MenuEcholocationRadar>();
|
||||
echoRadar.maxSimultaneousWaves = 4;
|
||||
echoRadar.waveMaxRadius = 1600f; // Расходится на весь экран
|
||||
echoRadar.waveSpeed = 240f;
|
||||
echoRadar.waveSpawnInterval = 1.7f;
|
||||
echoRadar.initialThickness = 14f;
|
||||
echoRadar.maxThickness = 52f;
|
||||
echoRadar.waveBaseColor = new Color(1.00f, 0.85f, 0.10f, 0.85f); // Яркий желтый
|
||||
echoRadar.waveCoreColor = new Color(1.00f, 0.98f, 0.55f, 1.00f); // Светло-желтое ядро
|
||||
echoRadar.beaconColor = new Color(1.00f, 0.88f, 0.15f, 1.00f);
|
||||
|
||||
// Копирайт / версия в правом нижнем углу
|
||||
CreateText("Version_Text", canvasGo.transform,
|
||||
"Версия 1.0.0 | Лаборатория 'Эхо'",
|
||||
14, FontStyle.Normal, TextAnchor.MiddleRight,
|
||||
new Color(0.40f, 0.52f, 0.62f, 0.75f),
|
||||
new Vector2(0.70f, 0.02f), new Vector2(0.98f, 0.06f), Vector2.zero, Vector2.zero);
|
||||
// Визуальный корпус излучателя (Желтые концентрические кольца)
|
||||
GameObject reticleOuter = CreateImage("Radar_ReticleOuter", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.20f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(180f, 180f), Vector2.zero);
|
||||
Outline reticleOutline = reticleOuter.AddComponent<Outline>();
|
||||
reticleOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.35f);
|
||||
reticleOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
// 6. Заголовок игры (Логотип и подзаголовок)
|
||||
CreateImage("Radar_ReticleInner", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.08f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(90f, 90f), Vector2.zero);
|
||||
|
||||
// Крестовина сонара
|
||||
CreateImage("Crosshair_H", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.25f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(220f, 1.5f), Vector2.zero);
|
||||
|
||||
CreateImage("Crosshair_V", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.25f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(1.5f, 220f), Vector2.zero);
|
||||
|
||||
// Пульсирующая точка в центре
|
||||
GameObject beaconObj = CreateImage("Radar_BeaconDot", radarRoot.transform,
|
||||
new Color(1.00f, 0.92f, 0.20f, 1.0f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(14f, 14f), Vector2.zero);
|
||||
echoRadar.radarBeaconDot = beaconObj.GetComponent<Image>();
|
||||
echoRadar.radarReticle = reticleOuter.GetComponent<Image>();
|
||||
|
||||
// (Никакого лишнего текста в радаре нет)
|
||||
|
||||
// ==========================================
|
||||
// 7. НАЗВАНИЕ ИГРЫ: "Synthesia" В ЦЕНТРЕ (РУКОПИСНЫЙ ШРИФТ)
|
||||
// ==========================================
|
||||
GameObject headerContainer = CreateEmptyRect("Header_Container", canvasGo.transform,
|
||||
new Vector2(0.08f, 0.64f), new Vector2(0.55f, 0.90f), Vector2.zero, Vector2.zero);
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(1100f, 200f), new Vector2(0f, 210f));
|
||||
|
||||
CreateText("Title_Text", headerContainer.transform,
|
||||
"ECHO // PROTOCOL",
|
||||
48, FontStyle.Bold, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.97f, 1f, 1f),
|
||||
new Vector2(0f, 0.40f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
GameObject titleObj = CreateTextWithFont("Title_Synthesia", headerContainer.transform,
|
||||
"Synthesia",
|
||||
handwrittenFont,
|
||||
110, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(1.0f, 1.0f, 1.0f, 1.0f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateText("Subtitle_Text", headerContainer.transform,
|
||||
"ТАКТИЧЕСКИЙ СТЕЛС-ЭКШЕН • СЕКРЕТНЫЙ ОБЪЕКТ",
|
||||
16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.85f),
|
||||
new Vector2(0f, 0.12f), new Vector2(1f, 0.40f), Vector2.zero, Vector2.zero);
|
||||
// Теплый желтый ореол свечения
|
||||
Outline titleGlow = titleObj.AddComponent<Outline>();
|
||||
titleGlow.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.50f);
|
||||
titleGlow.effectDistance = new Vector2(2.5f, -2.5f);
|
||||
|
||||
CreateImage("Header_Divider", headerContainer.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.45f),
|
||||
new Vector2(0f, 0.02f), new Vector2(0.85f, 0.05f), Vector2.zero, Vector2.zero);
|
||||
Shadow titleShadow = titleObj.AddComponent<Shadow>();
|
||||
titleShadow.effectColor = new Color(0.12f, 0.10f, 0.00f, 0.80f);
|
||||
titleShadow.effectDistance = new Vector2(4f, -4f);
|
||||
|
||||
// 7. Основная панель кнопок меню (MainMenuPanel)
|
||||
// ==========================================
|
||||
// 8. КНОПКИ В ЦЕНТРЕ (БОЛЬШИЕ, ЯРКИЕ ЖЕЛТЫЕ, ОЧЕВИДНО НЕ ЧЕРНЫЕ)
|
||||
// ==========================================
|
||||
GameObject mainMenuPanel = CreateEmptyRect("MainMenuPanel", canvasGo.transform,
|
||||
new Vector2(0.08f, 0.18f), new Vector2(0.38f, 0.60f), Vector2.zero, Vector2.zero);
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(620f, 380f), new Vector2(0f, -110f));
|
||||
|
||||
VerticalLayoutGroup menuLayout = mainMenuPanel.AddComponent<VerticalLayoutGroup>();
|
||||
menuLayout.childAlignment = TextAnchor.UpperLeft;
|
||||
menuLayout.spacing = 18f;
|
||||
menuLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
menuLayout.spacing = 24f;
|
||||
menuLayout.childControlWidth = true;
|
||||
menuLayout.childControlHeight = false;
|
||||
menuLayout.childControlHeight = true;
|
||||
menuLayout.childForceExpandWidth = true;
|
||||
menuLayout.childForceExpandHeight = false;
|
||||
|
||||
// Кнопка "ИГРАТЬ"
|
||||
Button playBtn = CreateStyledButton("Button_Play", mainMenuPanel.transform,
|
||||
"► ИГРАТЬ",
|
||||
new Color(0.08f, 0.22f, 0.32f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.04f, 0.14f, 0.22f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
66f, 24);
|
||||
// Яркий золотисто-желтый цвет кнопок с глубоким черным текстом (очевидно не черные)
|
||||
Color yellowBtnNormal = new Color(0.95f, 0.78f, 0.12f, 1.00f);
|
||||
Color yellowBtnHover = new Color(1.00f, 0.90f, 0.35f, 1.00f);
|
||||
Color yellowBtnPress = new Color(0.78f, 0.62f, 0.08f, 1.00f);
|
||||
Color blackBtnText = new Color(0.06f, 0.06f, 0.06f, 1.00f);
|
||||
|
||||
// Кнопка "НАСТРОЙКИ"
|
||||
Button settingsBtn = CreateStyledButton("Button_Settings", mainMenuPanel.transform,
|
||||
"⚙ НАСТРОЙКИ",
|
||||
new Color(0.07f, 0.12f, 0.18f, 0.90f),
|
||||
new Color(0.18f, 0.38f, 0.52f, 1.0f),
|
||||
new Color(0.04f, 0.08f, 0.12f, 1.0f),
|
||||
new Color(0.85f, 0.92f, 0.98f, 1.0f),
|
||||
62f, 22);
|
||||
// Кнопка 1: "ИГРАТЬ"
|
||||
Button playBtn = CreateBigMenuButton("Button_Play", mainMenuPanel.transform,
|
||||
"ИГРАТЬ",
|
||||
yellowBtnNormal,
|
||||
yellowBtnHover,
|
||||
yellowBtnPress,
|
||||
blackBtnText,
|
||||
90f, 34);
|
||||
|
||||
// Кнопка "ВЫХОД"
|
||||
Button quitBtn = CreateStyledButton("Button_Quit", mainMenuPanel.transform,
|
||||
"✖ ВЫХОД ИЗ ИГРЫ",
|
||||
new Color(0.18f, 0.08f, 0.10f, 0.90f),
|
||||
new Color(0.55f, 0.16f, 0.22f, 1.0f),
|
||||
new Color(0.10f, 0.04f, 0.06f, 1.0f),
|
||||
new Color(0.95f, 0.85f, 0.85f, 1.0f),
|
||||
62f, 22);
|
||||
// Кнопка 2: "НАСТРОЙКИ"
|
||||
Button settingsBtn = CreateBigMenuButton("Button_Settings", mainMenuPanel.transform,
|
||||
"НАСТРОЙКИ",
|
||||
yellowBtnNormal,
|
||||
yellowBtnHover,
|
||||
yellowBtnPress,
|
||||
blackBtnText,
|
||||
90f, 34);
|
||||
|
||||
// Кнопка 3: "ВЫХОД"
|
||||
Button quitBtn = CreateBigMenuButton("Button_Quit", mainMenuPanel.transform,
|
||||
"ВЫХОД",
|
||||
yellowBtnNormal,
|
||||
yellowBtnHover,
|
||||
yellowBtnPress,
|
||||
blackBtnText,
|
||||
90f, 34);
|
||||
|
||||
// ==========================================
|
||||
// 8. Панель настроек (SettingsPanel)
|
||||
// 9. ПАНЕЛЬ НАСТРОЕК (В ЧЕРНО-ЖЕЛТОМ СТИЛЕ)
|
||||
// ==========================================
|
||||
GameObject settingsPanel = CreateEmptyRect("SettingsPanel", canvasGo.transform,
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Затемняющий фон
|
||||
CreateImage("Backdrop_Dim", settingsPanel.transform,
|
||||
new Color(0.01f, 0.02f, 0.03f, 0.78f),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.92f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Модальное окно
|
||||
// Модальное окно настроек
|
||||
GameObject settingsCard = CreateImage("Settings_Card", settingsPanel.transform,
|
||||
new Color(0.05f, 0.08f, 0.12f, 0.98f),
|
||||
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(920f, 720f), Vector2.zero);
|
||||
new Vector2(920f, 740f), Vector2.zero);
|
||||
|
||||
Outline panelOutline = settingsCard.AddComponent<Outline>();
|
||||
panelOutline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.50f);
|
||||
panelOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
||||
panelOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
// Заголовок панели настроек
|
||||
CreateText("Settings_Header", settingsCard.transform,
|
||||
"НАСТРОЙКИ СИСТЕМЫ",
|
||||
"НАСТРОЙКИ",
|
||||
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.90f, 0.97f, 1.0f, 1.0f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0.05f, 0.90f), new Vector2(0.95f, 0.98f), Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Settings_Divider", settingsCard.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.35f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
||||
new Vector2(0.05f, 0.89f), new Vector2(0.95f, 0.895f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Контейнер списка настроек
|
||||
@@ -183,7 +241,7 @@ public static class MainMenuSceneBuilder
|
||||
new Vector2(0.06f, 0.14f), new Vector2(0.94f, 0.87f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup settingsLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
settingsLayout.spacing = 16f;
|
||||
settingsLayout.spacing = 15f;
|
||||
settingsLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
settingsLayout.childControlWidth = true;
|
||||
settingsLayout.childControlHeight = false;
|
||||
@@ -191,16 +249,16 @@ public static class MainMenuSceneBuilder
|
||||
settingsLayout.childForceExpandHeight = false;
|
||||
|
||||
// --- Раздел: Звук ---
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— АУДИО И ЗВУК —");
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— ЗВУК И ЭХОЛОКАЦИЯ —");
|
||||
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Общая громкость", 0f, 1f, 1f, "%");
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Громкость звука", 0f, 1f, 1f, "%");
|
||||
Slider volSlider = volumeRow.slider;
|
||||
Text volText = volumeRow.valueText;
|
||||
|
||||
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук (Mute)");
|
||||
|
||||
// --- Раздел: Графика ---
|
||||
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА И ДИСПЛЕЙ —");
|
||||
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА —");
|
||||
|
||||
Dropdown qualityDropdown = CreateDropdownRow("Row_Quality", settingsList.transform, "Качество графики");
|
||||
Toggle fullscreenToggle = CreateToggleRow("Row_Fullscreen", settingsList.transform, "Полноэкранный режим");
|
||||
@@ -225,45 +283,46 @@ public static class MainMenuSceneBuilder
|
||||
bottomLayout.childForceExpandWidth = true;
|
||||
bottomLayout.childForceExpandHeight = true;
|
||||
|
||||
Button resetBtn = CreateStyledButton("Button_ResetDefaults", bottomButtonsRow.transform,
|
||||
"Сбросить настройки",
|
||||
new Color(0.18f, 0.12f, 0.14f, 0.95f),
|
||||
new Color(0.35f, 0.18f, 0.22f, 1.0f),
|
||||
new Color(0.12f, 0.06f, 0.08f, 1.0f),
|
||||
new Color(0.95f, 0.85f, 0.85f, 1.0f),
|
||||
Button resetBtn = CreateBigMenuButton("Button_ResetDefaults", bottomButtonsRow.transform,
|
||||
"Сброс",
|
||||
new Color(0.35f, 0.15f, 0.15f, 1.0f),
|
||||
new Color(0.50f, 0.20f, 0.20f, 1.0f),
|
||||
new Color(0.65f, 0.25f, 0.25f, 1.0f),
|
||||
Color.white,
|
||||
50f, 18);
|
||||
|
||||
Button backBtn = CreateStyledButton("Button_Back", bottomButtonsRow.transform,
|
||||
"✔ НАЗАД В МЕНЮ",
|
||||
new Color(0.08f, 0.22f, 0.30f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.05f, 0.14f, 0.20f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
50f, 20);
|
||||
Button backBtn = CreateBigMenuButton("Button_Back", bottomButtonsRow.transform,
|
||||
"Применить и выйти",
|
||||
new Color(0.95f, 0.78f, 0.12f, 1.0f),
|
||||
new Color(1.00f, 0.90f, 0.35f, 1.0f),
|
||||
new Color(0.78f, 0.62f, 0.08f, 1.0f),
|
||||
new Color(0.06f, 0.06f, 0.06f, 1.0f),
|
||||
50f, 18);
|
||||
|
||||
// ==========================================
|
||||
// 9. Панель загрузки (LoadingPanel)
|
||||
// 10. ПАНЕЛЬ ЗАГРУЗКИ (LOADING PANEL)
|
||||
// ==========================================
|
||||
GameObject loadingPanel = CreateImage("LoadingPanel", canvasGo.transform,
|
||||
new Color(0.02f, 0.03f, 0.05f, 0.97f),
|
||||
new Color(0f, 0f, 0f, 0.98f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject loadingContainer = CreateEmptyRect("Loading_Container", loadingPanel.transform,
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(600f, 200f), Vector2.zero);
|
||||
new Vector2(640f, 220f), Vector2.zero);
|
||||
|
||||
CreateText("Loading_Title", loadingContainer.transform,
|
||||
"ЗАГРУЗКА МИССИИ...",
|
||||
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.00f, 0.85f, 0.95f, 1.0f),
|
||||
new Vector2(0f, 0.60f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
CreateTextWithFont("Loading_Title", loadingContainer.transform,
|
||||
"Synthesia",
|
||||
handwrittenFont,
|
||||
52, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0f, 0.65f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
||||
sliderObj.name = "Loading_ProgressBar";
|
||||
sliderObj.transform.SetParent(loadingContainer.transform, false);
|
||||
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
||||
sliderRt.anchorMin = new Vector2(0.05f, 0.35f);
|
||||
sliderRt.anchorMax = new Vector2(0.95f, 0.55f);
|
||||
sliderRt.anchorMin = new Vector2(0.05f, 0.38f);
|
||||
sliderRt.anchorMax = new Vector2(0.95f, 0.52f);
|
||||
sliderRt.offsetMin = Vector2.zero;
|
||||
sliderRt.offsetMax = Vector2.zero;
|
||||
|
||||
@@ -273,68 +332,86 @@ public static class MainMenuSceneBuilder
|
||||
if (fillTransform != null)
|
||||
{
|
||||
Image fillImg = fillTransform.GetComponent<Image>();
|
||||
if (fillImg != null) fillImg.color = new Color(0.00f, 0.85f, 0.95f, 1f);
|
||||
if (fillImg != null) fillImg.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
||||
}
|
||||
|
||||
GameObject loadingPercent = CreateText("Loading_Text", loadingContainer.transform,
|
||||
"0%",
|
||||
"Загрузка...",
|
||||
18, FontStyle.Normal, TextAnchor.MiddleCenter,
|
||||
new Color(0.80f, 0.90f, 1.0f, 0.9f),
|
||||
new Color(0.95f, 0.95f, 0.95f, 0.9f),
|
||||
new Vector2(0f, 0f), new Vector2(1f, 0.30f), Vector2.zero, Vector2.zero);
|
||||
Text loadingText = loadingPercent.GetComponent<Text>();
|
||||
|
||||
// ==========================================
|
||||
// 10. Привязка ссылок к MainMenuManager
|
||||
// 11. ПРИВЯЗКА К MAINMENUMANAGER
|
||||
// ==========================================
|
||||
manager.headerContainer = headerContainer;
|
||||
manager.mainMenuPanel = mainMenuPanel;
|
||||
manager.settingsPanel = settingsPanel;
|
||||
manager.loadingPanel = loadingPanel;
|
||||
manager.gameSceneName = "SampleScene";
|
||||
|
||||
manager.loadingSlider = loadingSlider;
|
||||
manager.loadingText = loadingText;
|
||||
|
||||
manager.volumeSlider = volSlider;
|
||||
manager.volumeValueText = volText;
|
||||
manager.muteToggle = muteToggle;
|
||||
|
||||
manager.qualityDropdown = qualityDropdown;
|
||||
manager.fullscreenToggle = fullscreenToggle;
|
||||
manager.resolutionDropdown = resolutionDropdown;
|
||||
|
||||
manager.sensitivitySlider = sensSlider;
|
||||
manager.sensitivityValueText = sensText;
|
||||
manager.gameSceneName = "SampleScene";
|
||||
|
||||
// Привязываем кнопки через UnityEvent
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(playBtn.onClick, manager.PlayGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(settingsBtn.onClick, manager.OpenSettings);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(quitBtn.onClick, manager.QuitGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, manager.CloseSettings);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(resetBtn.onClick, manager.ResetToDefaults);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, manager.CloseSettings);
|
||||
|
||||
// Изначальная видимость панелей
|
||||
headerContainer.SetActive(true);
|
||||
mainMenuPanel.SetActive(true);
|
||||
// По умолчанию активны главное меню и радар
|
||||
settingsPanel.SetActive(false);
|
||||
loadingPanel.SetActive(false);
|
||||
mainMenuPanel.SetActive(true);
|
||||
headerContainer.SetActive(true);
|
||||
|
||||
// 11. Сохранение сцены и Build Settings
|
||||
// Сохраняем сцену MainMenu
|
||||
string scenePath = "Assets/Scenes/MainMenu.unity";
|
||||
EditorSceneManager.SaveScene(newScene, scenePath);
|
||||
Debug.Log("[MainMenuSceneBuilder] Сцена создана: " + scenePath);
|
||||
Debug.Log("[MainMenuSceneBuilder] Сцена Synthesia MainMenu успешно создана: " + scenePath);
|
||||
|
||||
List<EditorBuildSettingsScene> buildScenes = new List<EditorBuildSettingsScene>();
|
||||
buildScenes.Add(new EditorBuildSettingsScene(scenePath, true));
|
||||
buildScenes.Add(new EditorBuildSettingsScene("Assets/Scenes/SampleScene.unity", true));
|
||||
EditorBuildSettings.scenes = buildScenes.ToArray();
|
||||
// Добавляем в Build Settings при необходимости
|
||||
EnsureSceneInBuildSettings(scenePath, 0);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
return "SUCCESS: MainMenu created and configured!";
|
||||
return "SUCCESS: Minimalist Black & Yellow MainMenu 'Synthesia' successfully built!";
|
||||
}
|
||||
|
||||
#region Хелперы создания UI элементов
|
||||
private static void EnsureSceneInBuildSettings(string scenePath, int targetIndex)
|
||||
{
|
||||
List<EditorBuildSettingsScene> list = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].path == scenePath)
|
||||
{
|
||||
if (i != targetIndex && targetIndex < list.Count)
|
||||
{
|
||||
var item = list[i];
|
||||
list.RemoveAt(i);
|
||||
list.Insert(targetIndex, item);
|
||||
EditorBuildSettings.scenes = list.ToArray();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (targetIndex >= 0 && targetIndex <= list.Count)
|
||||
list.Insert(targetIndex, new EditorBuildSettingsScene(scenePath, true));
|
||||
else
|
||||
list.Add(new EditorBuildSettingsScene(scenePath, true));
|
||||
|
||||
EditorBuildSettings.scenes = list.ToArray();
|
||||
}
|
||||
|
||||
#region Хелперы UI
|
||||
|
||||
private static GameObject CreateEmptyRect(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
@@ -353,32 +430,41 @@ public static class MainMenuSceneBuilder
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Image img = go.AddComponent<Image>();
|
||||
img.color = color;
|
||||
img.sprite = uiResources.background;
|
||||
img.type = Image.Type.Sliced;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static GameObject CreateText(string name, Transform parent, string text, int fontSize, FontStyle style, TextAnchor alignment, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
return CreateTextWithFont(name, parent, text, standardFont, fontSize, style, alignment, color, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
}
|
||||
|
||||
private static GameObject CreateTextWithFont(string name, Transform parent, string text, Font font, int fontSize, FontStyle style, TextAnchor alignment, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
t.font = font != null ? font : standardFont;
|
||||
t.text = text;
|
||||
t.fontSize = fontSize;
|
||||
t.fontStyle = style;
|
||||
t.alignment = alignment;
|
||||
t.color = color;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
t.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static Button CreateStyledButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
||||
private static Button CreateBigMenuButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
||||
{
|
||||
GameObject btnObj = DefaultControls.CreateButton(uiResources);
|
||||
btnObj.name = name;
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
RectTransform rt = btnObj.GetComponent<RectTransform>();
|
||||
if (rt != null)
|
||||
{
|
||||
rt.sizeDelta = new Vector2(rt.sizeDelta.x, height);
|
||||
}
|
||||
|
||||
LayoutElement layout = btnObj.AddComponent<LayoutElement>();
|
||||
layout.minHeight = height;
|
||||
layout.preferredHeight = height;
|
||||
@@ -387,6 +473,15 @@ public static class MainMenuSceneBuilder
|
||||
img.color = normalColor;
|
||||
img.type = Image.Type.Sliced;
|
||||
|
||||
// Выразительная окантовка кнопки
|
||||
Outline btnOutline = btnObj.AddComponent<Outline>();
|
||||
btnOutline.effectColor = new Color(1.00f, 0.95f, 0.60f, 0.70f);
|
||||
btnOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
Shadow btnShadow = btnObj.AddComponent<Shadow>();
|
||||
btnShadow.effectColor = new Color(0.00f, 0.00f, 0.00f, 0.50f);
|
||||
btnShadow.effectDistance = new Vector2(3f, -3f);
|
||||
|
||||
Button btn = btnObj.GetComponent<Button>();
|
||||
ColorBlock colors = btn.colors;
|
||||
colors.normalColor = normalColor;
|
||||
@@ -406,6 +501,8 @@ public static class MainMenuSceneBuilder
|
||||
text.fontStyle = FontStyle.Bold;
|
||||
text.color = textColor;
|
||||
text.alignment = TextAnchor.MiddleCenter;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
text.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
}
|
||||
|
||||
return btn;
|
||||
@@ -421,72 +518,49 @@ public static class MainMenuSceneBuilder
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
t.text = text;
|
||||
t.fontSize = 17;
|
||||
t.fontSize = 16;
|
||||
t.fontStyle = FontStyle.Bold;
|
||||
t.alignment = TextAnchor.MiddleLeft;
|
||||
t.color = new Color(0.00f, 0.85f, 0.95f, 0.95f);
|
||||
t.color = new Color(1.00f, 0.85f, 0.10f, 0.95f);
|
||||
}
|
||||
|
||||
private struct SliderRow
|
||||
private static (Slider slider, Text valueText) CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unitSuffix)
|
||||
{
|
||||
public Slider slider;
|
||||
public Text valueText;
|
||||
}
|
||||
|
||||
private static SliderRow CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unit)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 42f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 42f;
|
||||
layout.preferredHeight = 42f;
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 42f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
|
||||
// Slider
|
||||
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
||||
sliderObj.name = "Slider";
|
||||
sliderObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement sliderLayout = sliderObj.AddComponent<LayoutElement>();
|
||||
sliderLayout.minWidth = 360f;
|
||||
sliderLayout.preferredWidth = 360f;
|
||||
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
||||
sliderRt.anchorMin = new Vector2(0.42f, 0.20f);
|
||||
sliderRt.anchorMax = new Vector2(0.82f, 0.80f);
|
||||
sliderRt.offsetMin = Vector2.zero;
|
||||
sliderRt.offsetMax = Vector2.zero;
|
||||
|
||||
Slider slider = sliderObj.GetComponent<Slider>();
|
||||
slider.minValue = min;
|
||||
slider.maxValue = max;
|
||||
slider.value = def;
|
||||
|
||||
// Значение текстом
|
||||
GameObject valGo = CreateEmptyRect("ValueText", row.transform, Vector2.zero, Vector2.one, new Vector2(90f, 42f), Vector2.zero);
|
||||
LayoutElement valLayout = valGo.AddComponent<LayoutElement>();
|
||||
valLayout.minWidth = 90f;
|
||||
valLayout.preferredWidth = 90f;
|
||||
Text valText = valGo.AddComponent<Text>();
|
||||
valText.font = standardFont;
|
||||
valText.text = unit == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unit}";
|
||||
valText.fontSize = 18;
|
||||
valText.fontStyle = FontStyle.Bold;
|
||||
valText.alignment = TextAnchor.MiddleCenter;
|
||||
valText.color = new Color(0.00f, 0.85f, 0.95f, 1f);
|
||||
Transform fill = sliderObj.transform.Find("Fill Area/Fill");
|
||||
if (fill != null)
|
||||
{
|
||||
var img = fill.GetComponent<Image>();
|
||||
if (img != null) img.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
||||
}
|
||||
|
||||
return new SliderRow { slider = slider, valueText = valText };
|
||||
GameObject valueTextObj = CreateText("ValueText", row.transform,
|
||||
unitSuffix == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unitSuffix}",
|
||||
15, FontStyle.Bold, TextAnchor.MiddleRight,
|
||||
new Color(1.00f, 0.85f, 0.10f, 1f), new Vector2(0.84f, 0f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
return (slider, valueTextObj.GetComponent<Text>());
|
||||
}
|
||||
|
||||
private static Toggle CreateToggleRow(string name, Transform parent, string label)
|
||||
@@ -496,39 +570,22 @@ public static class MainMenuSceneBuilder
|
||||
layout.minHeight = 40f;
|
||||
layout.preferredHeight = 40f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.70f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 40f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
|
||||
// Toggle
|
||||
GameObject toggleObj = DefaultControls.CreateToggle(uiResources);
|
||||
toggleObj.name = "Toggle";
|
||||
toggleObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement toggleLayout = toggleObj.AddComponent<LayoutElement>();
|
||||
toggleLayout.minWidth = 50f;
|
||||
toggleLayout.preferredWidth = 50f;
|
||||
RectTransform rt = toggleObj.GetComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.85f, 0.15f);
|
||||
rt.anchorMax = new Vector2(1f, 0.85f);
|
||||
rt.offsetMin = Vector2.zero;
|
||||
rt.offsetMax = Vector2.zero;
|
||||
|
||||
Text toggleLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (toggleLabel != null) toggleLabel.text = "";
|
||||
Text defaultLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (defaultLabel != null) Object.DestroyImmediate(defaultLabel.gameObject);
|
||||
|
||||
Toggle toggle = toggleObj.GetComponent<Toggle>();
|
||||
return toggle;
|
||||
return toggleObj.GetComponent<Toggle>();
|
||||
}
|
||||
|
||||
private static Dropdown CreateDropdownRow(string name, Transform parent, string label)
|
||||
@@ -538,41 +595,22 @@ public static class MainMenuSceneBuilder
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 44f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
GameObject ddObj = DefaultControls.CreateDropdown(uiResources);
|
||||
ddObj.name = "Dropdown";
|
||||
ddObj.transform.SetParent(row.transform, false);
|
||||
RectTransform rt = ddObj.GetComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.42f, 0.10f);
|
||||
rt.anchorMax = new Vector2(1f, 0.90f);
|
||||
rt.offsetMin = Vector2.zero;
|
||||
rt.offsetMax = Vector2.zero;
|
||||
|
||||
// Dropdown
|
||||
GameObject dropdownObj = DefaultControls.CreateDropdown(uiResources);
|
||||
dropdownObj.name = "Dropdown";
|
||||
dropdownObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement ddLayout = dropdownObj.AddComponent<LayoutElement>();
|
||||
ddLayout.minWidth = 420f;
|
||||
ddLayout.preferredWidth = 420f;
|
||||
Image img = ddObj.GetComponent<Image>();
|
||||
if (img != null) img.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
||||
|
||||
Dropdown dropdown = dropdownObj.GetComponent<Dropdown>();
|
||||
Text caption = dropdown.captionText;
|
||||
if (caption != null) caption.font = standardFont;
|
||||
Text item = dropdown.itemText;
|
||||
if (item != null) item.font = standardFont;
|
||||
|
||||
return dropdown;
|
||||
return ddObj.GetComponent<Dropdown>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public static class MutantPopulationSetup
|
||||
{
|
||||
private const string MutantPrefabPath = "Assets/Prefabs/Mutant.prefab";
|
||||
|
||||
[MenuItem("Tools/Populate Mutants Across Complex")]
|
||||
public static string Populate()
|
||||
{
|
||||
var mutantPrefab = AssetDatabase.LoadAssetAtPath<GameObject>(MutantPrefabPath);
|
||||
if (mutantPrefab == null)
|
||||
{
|
||||
Debug.LogError($"[MutantPopulationSetup] Prefab not found at {MutantPrefabPath}");
|
||||
return "ERROR: Mutant.prefab not found!";
|
||||
}
|
||||
|
||||
// 1. Очищаем старых мутантов в сцене
|
||||
var existingEnemies = Object.FindObjectsByType<BlindMutantAI>();
|
||||
foreach (var e in existingEnemies)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(e.gameObject);
|
||||
}
|
||||
|
||||
var oldEnemiesRoot = GameObject.Find("Enemies");
|
||||
if (oldEnemiesRoot != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldEnemiesRoot);
|
||||
}
|
||||
|
||||
GameObject enemiesRoot = new GameObject("Enemies");
|
||||
Undo.RegisterCreatedObjectUndo(enemiesRoot, "Create Enemies");
|
||||
|
||||
// 2. Получаем или создаем глобальные точки патрулирования комплекса
|
||||
Transform[] globalPatrolWaypoints = EnsureGlobalPatrolWaypoints();
|
||||
|
||||
// 3. Создаем глобальных бродячих мутантов (Facility Roamers)
|
||||
GameObject roamersGroup = new GameObject("Facility_Roamers");
|
||||
roamersGroup.transform.SetParent(enemiesRoot.transform);
|
||||
|
||||
// 4 бродячих мутанта, патрулирующих коридоры и открытые зоны комплекса
|
||||
SpawnMutant(mutantPrefab, roamersGroup.transform, "Mutant_Roamer_Concourse", new Vector3(0f, 0.08f, -30f), globalPatrolWaypoints, startIndex: 0, isRoomConfined: false);
|
||||
SpawnMutant(mutantPrefab, roamersGroup.transform, "Mutant_Roamer_WestSlalom", new Vector3(-21f, 0.08f, 6f), globalPatrolWaypoints, startIndex: 7, isRoomConfined: false);
|
||||
SpawnMutant(mutantPrefab, roamersGroup.transform, "Mutant_Roamer_GrandAtrium", new Vector3(0f, 0.08f, 9f), globalPatrolWaypoints, startIndex: 23, isRoomConfined: false);
|
||||
SpawnMutant(mutantPrefab, roamersGroup.transform, "Mutant_Roamer_NorthBypass", new Vector3(-15f, 0.08f, 47.5f), globalPatrolWaypoints, startIndex: 15, isRoomConfined: false);
|
||||
|
||||
// 4. Комнаты с БОЛЬШИМ количеством мутантов (Гнёзда / Опасные зоны)
|
||||
|
||||
// --- SECTOR F: Quarantine Wing / Cellblock (Лабиринт с изоляторами) — 5 МУТАНТОВ ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Quarantine_Wing_Swarm",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(-35f, 0.08f, 8f), // Южный коридор блока
|
||||
new Vector3(-43f, 0.08f, 9f), // Камера 1
|
||||
new Vector3(-27f, 0.08f, 9f), // Камера 2
|
||||
new Vector3(-35f, 0.08f, 16f), // Средний коридор
|
||||
new Vector3(-43f, 0.08f, 16f), // Камера 3
|
||||
new Vector3(-27f, 0.08f, 16f), // Камера 4
|
||||
new Vector3(-35f, 0.08f, 23f), // Северный коридор
|
||||
new Vector3(-43f, 0.08f, 23f) // Камера 5
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(-43f, 0.08f, 9f),
|
||||
new Vector3(-27f, 0.08f, 9f),
|
||||
new Vector3(-35f, 0.08f, 16f),
|
||||
new Vector3(-43f, 0.08f, 16f),
|
||||
new Vector3(-43f, 0.08f, 23f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR H: Chemical Silos & Toxic Waste — 4 МУТАНТА ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Chemical_Silos_Hazard",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(-43f, 0.08f, 33f),
|
||||
new Vector3(-31f, 0.08f, 33f),
|
||||
new Vector3(-31f, 0.08f, 43f),
|
||||
new Vector3(-43f, 0.08f, 43f),
|
||||
new Vector3(-37f, 0.08f, 38f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(-42f, 0.08f, 34f),
|
||||
new Vector3(-32f, 0.08f, 34f),
|
||||
new Vector3(-32f, 0.08f, 42f),
|
||||
new Vector3(-42f, 0.08f, 42f)
|
||||
}
|
||||
);
|
||||
|
||||
// 5. Комнаты с ПАРОЙ мутантов (по 2 мутанта на комнату)
|
||||
|
||||
// --- SECTOR B: Cryogenics Vault — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Cryogenics",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(-43f, 0.08f, -43f),
|
||||
new Vector3(-31f, 0.08f, -43f),
|
||||
new Vector3(-31f, 0.08f, -31f),
|
||||
new Vector3(-43f, 0.08f, -31f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(-40f, 0.08f, -40f),
|
||||
new Vector3(-34f, 0.08f, -34f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR C: Security Armory & Surveillance — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Armory",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(31f, 0.08f, -43f),
|
||||
new Vector3(43f, 0.08f, -43f),
|
||||
new Vector3(43f, 0.08f, -31f),
|
||||
new Vector3(31f, 0.08f, -31f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(34f, 0.08f, -40f),
|
||||
new Vector3(40f, 0.08f, -34f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR D: Biochemistry Research Wing — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Biochem",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(-42f, 0.08f, -16f),
|
||||
new Vector3(-30f, 0.08f, -16f),
|
||||
new Vector3(-30f, 0.08f, -4f),
|
||||
new Vector3(-42f, 0.08f, -4f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(-39f, 0.08f, -14f),
|
||||
new Vector3(-33f, 0.08f, -6f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR E: Surgical Theatre & ICU — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Surgical_ICU",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(30f, 0.08f, -16f),
|
||||
new Vector3(42f, 0.08f, -16f),
|
||||
new Vector3(42f, 0.08f, -4f),
|
||||
new Vector3(30f, 0.08f, -4f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(33f, 0.08f, -14f),
|
||||
new Vector3(39f, 0.08f, -6f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR G: Genetics & Cybernetics — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Genetics",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(28f, 0.08f, 10f),
|
||||
new Vector3(42f, 0.08f, 10f),
|
||||
new Vector3(42f, 0.08f, 22f),
|
||||
new Vector3(28f, 0.08f, 22f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(31f, 0.08f, 12f),
|
||||
new Vector3(39f, 0.08f, 20f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR I: Auxiliary Power Substation — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Substation",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(31f, 0.08f, 33f),
|
||||
new Vector3(43f, 0.08f, 33f),
|
||||
new Vector3(43f, 0.08f, 43f),
|
||||
new Vector3(31f, 0.08f, 43f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(34f, 0.08f, 35f),
|
||||
new Vector3(40f, 0.08f, 41f)
|
||||
}
|
||||
);
|
||||
|
||||
// --- SECTOR K: Sub-Reactor Turbine Hall — 2 мутанта ---
|
||||
SetupRoomGroup(mutantPrefab, enemiesRoot.transform, "Room_Reactor_Hall",
|
||||
waypoints: new Vector3[]
|
||||
{
|
||||
new Vector3(-14f, 0.08f, 38f),
|
||||
new Vector3(0f, 0.08f, 38f),
|
||||
new Vector3(14f, 0.08f, 38f),
|
||||
new Vector3(0f, 0.08f, 44f)
|
||||
},
|
||||
spawnPositions: new Vector3[]
|
||||
{
|
||||
new Vector3(-10f, 0.08f, 38f),
|
||||
new Vector3(10f, 0.08f, 38f)
|
||||
}
|
||||
);
|
||||
|
||||
EditorUtility.SetDirty(enemiesRoot);
|
||||
EditorSceneManager.MarkSceneDirty(enemiesRoot.scene);
|
||||
EditorSceneManager.SaveScene(enemiesRoot.scene);
|
||||
|
||||
string summary = $"[MutantPopulationSetup] Успешно создано и настроено 27 мутантов:\n" +
|
||||
$"- 4 общих патрульных по коридорам и атриуму\n" +
|
||||
$"- 5 мутантов в карантинном изоляторе (Quarantine Cellblock)\n" +
|
||||
$"- 4 мутанта на складе химикатов (Chemical Silos)\n" +
|
||||
$"- по 2 мутанта в 7 других лабораториях (Cryo, Armory, Biochem, Surgical, Genetics, Substation, Reactor)";
|
||||
Debug.Log($"<color=green>{summary}</color>");
|
||||
return summary;
|
||||
}
|
||||
|
||||
private static void SetupRoomGroup(GameObject prefab, Transform parent, string groupName, Vector3[] waypoints, Vector3[] spawnPositions)
|
||||
{
|
||||
GameObject roomGroup = new GameObject(groupName);
|
||||
roomGroup.transform.SetParent(parent);
|
||||
|
||||
// Точки патрулирования комнаты
|
||||
GameObject waypointsParent = new GameObject("Room_Waypoints");
|
||||
waypointsParent.transform.SetParent(roomGroup.transform);
|
||||
|
||||
Transform[] wpTransforms = new Transform[waypoints.Length];
|
||||
for (int i = 0; i < waypoints.Length; i++)
|
||||
{
|
||||
Vector3 targetPos = waypoints[i];
|
||||
if (NavMesh.SamplePosition(targetPos, out NavMeshHit hit, 3.0f, NavMesh.AllAreas))
|
||||
{
|
||||
targetPos = hit.position;
|
||||
}
|
||||
|
||||
var wpGo = new GameObject($"WP_{i}");
|
||||
wpGo.transform.SetParent(waypointsParent.transform);
|
||||
wpGo.transform.position = targetPos;
|
||||
wpTransforms[i] = wpGo.transform;
|
||||
}
|
||||
|
||||
// Создаем мутантов для комнаты
|
||||
for (int i = 0; i < spawnPositions.Length; i++)
|
||||
{
|
||||
Vector3 spawnPos = spawnPositions[i];
|
||||
if (NavMesh.SamplePosition(spawnPos, out NavMeshHit hit, 3.0f, NavMesh.AllAreas))
|
||||
{
|
||||
spawnPos = hit.position;
|
||||
}
|
||||
|
||||
SpawnMutant(prefab, roomGroup.transform, $"{groupName}_Mutant_{i + 1}", spawnPos, wpTransforms, startIndex: i % wpTransforms.Length, isRoomConfined: true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SpawnMutant(GameObject prefab, Transform parent, string name, Vector3 pos, Transform[] patrolPoints, int startIndex, bool isRoomConfined)
|
||||
{
|
||||
if (NavMesh.SamplePosition(pos, out NavMeshHit hit, 4.0f, NavMesh.AllAreas))
|
||||
{
|
||||
pos = hit.position;
|
||||
}
|
||||
|
||||
GameObject mutantGo = (GameObject)PrefabUtility.InstantiatePrefab(prefab, parent);
|
||||
mutantGo.name = name;
|
||||
mutantGo.transform.position = pos;
|
||||
mutantGo.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
|
||||
|
||||
var agent = mutantGo.GetComponent<NavMeshAgent>();
|
||||
if (agent != null)
|
||||
{
|
||||
agent.Warp(pos);
|
||||
agent.avoidancePriority = Random.Range(30, 70);
|
||||
}
|
||||
|
||||
var ai = mutantGo.GetComponent<BlindMutantAI>();
|
||||
if (ai != null)
|
||||
{
|
||||
ai.patrolPoints = patrolPoints;
|
||||
ai.isRoomConfined = isRoomConfined;
|
||||
ai.waitTimeAtPoint = Random.Range(1.2f, 2.2f);
|
||||
}
|
||||
|
||||
EditorUtility.SetDirty(mutantGo);
|
||||
}
|
||||
|
||||
private static Transform[] EnsureGlobalPatrolWaypoints()
|
||||
{
|
||||
var patrolRoot = GameObject.Find("PatrolWaypoints");
|
||||
if (patrolRoot != null && patrolRoot.transform.childCount > 0)
|
||||
{
|
||||
Transform[] pts = new Transform[patrolRoot.transform.childCount];
|
||||
for (int i = 0; i < patrolRoot.transform.childCount; i++)
|
||||
{
|
||||
pts[i] = patrolRoot.transform.GetChild(i);
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
||||
// Если не найден, создаем 32 точки
|
||||
patrolRoot = new GameObject("PatrolWaypoints");
|
||||
Vector3[] waypoints = new Vector3[]
|
||||
{
|
||||
new Vector3(0f, 0.08f, -30f),
|
||||
new Vector3(-18f, 0.08f, -30f),
|
||||
new Vector3(-37f, 0.08f, -37f),
|
||||
new Vector3(-37f, 0.08f, -24f),
|
||||
new Vector3(-37f, 0.08f, -14f),
|
||||
new Vector3(-37f, 0.08f, -4f),
|
||||
new Vector3(-21f, 0.08f, -4f),
|
||||
new Vector3(-21f, 0.08f, 6f),
|
||||
new Vector3(-35f, 0.08f, 8f),
|
||||
new Vector3(-43f, 0.08f, 9f),
|
||||
new Vector3(-35f, 0.08f, 16f),
|
||||
new Vector3(-27f, 0.08f, 16f),
|
||||
new Vector3(-35f, 0.08f, 23f),
|
||||
new Vector3(-37f, 0.08f, 38f),
|
||||
new Vector3(-37f, 0.08f, 47.5f),
|
||||
new Vector3(-15f, 0.08f, 47.5f),
|
||||
new Vector3(-10f, 0.08f, 38f),
|
||||
new Vector3(0f, 0.08f, 38f),
|
||||
new Vector3(10f, 0.08f, 38f),
|
||||
new Vector3(25f, 0.08f, 47.5f),
|
||||
new Vector3(37f, 0.08f, 38f),
|
||||
new Vector3(37f, 0.08f, 22f),
|
||||
new Vector3(37f, 0.08f, 10f),
|
||||
new Vector3(12f, 0.08f, 9f),
|
||||
new Vector3(0f, 0.08f, 18f),
|
||||
new Vector3(-12f, 0.08f, 9f),
|
||||
new Vector3(0f, 0.08f, 0f),
|
||||
new Vector3(21f, 0.08f, 0f),
|
||||
new Vector3(37f, 0.08f, -4f),
|
||||
new Vector3(37f, 0.08f, -14f),
|
||||
new Vector3(37f, 0.08f, -37f),
|
||||
new Vector3(18f, 0.08f, -30f)
|
||||
};
|
||||
|
||||
Transform[] res = new Transform[waypoints.Length];
|
||||
for (int i = 0; i < waypoints.Length; i++)
|
||||
{
|
||||
Vector3 pos = waypoints[i];
|
||||
if (NavMesh.SamplePosition(pos, out NavMeshHit hit, 3.0f, NavMesh.AllAreas))
|
||||
{
|
||||
pos = hit.position;
|
||||
}
|
||||
|
||||
var wpGo = new GameObject($"Waypoint_{i}");
|
||||
wpGo.transform.SetParent(patrolRoot.transform);
|
||||
wpGo.transform.position = pos;
|
||||
res[i] = wpGo.transform;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f17e077361eabb343a1347475044a52b
|
||||
@@ -38,8 +38,19 @@ public static class PauseMenuBuilder
|
||||
esGo.AddComponent<InputSystemUIInputModule>();
|
||||
}
|
||||
|
||||
// Удаляем старый PauseMenu, если был
|
||||
// Удаляем старый PauseMenu, если был (но сохраняем если есть продвинутый PauseRootPanel)
|
||||
var old = GameObject.Find("PauseCanvas");
|
||||
if (old != null && old.transform.Find("PauseRootPanel") != null)
|
||||
{
|
||||
var existingPm = old.GetComponent<PauseMenu>();
|
||||
if (existingPm == null) existingPm = old.AddComponent<PauseMenu>();
|
||||
existingPm.AutoWireUI();
|
||||
DeathScreenBuilder.Build();
|
||||
EditorSceneManager.SaveScene(gameplayScene);
|
||||
Debug.Log("[PauseMenuBuilder] PauseRootPanel обнаружен и успешно настроен в SampleScene.unity");
|
||||
return "SUCCESS: PauseRootPanel configured!";
|
||||
}
|
||||
|
||||
if (old != null) Object.DestroyImmediate(old);
|
||||
|
||||
// Создаем Canvas паузы
|
||||
@@ -215,6 +226,9 @@ public static class PauseMenuBuilder
|
||||
pausePanel.SetActive(false);
|
||||
settingsPanel.SetActive(false);
|
||||
|
||||
// Строим DeathScreenPanel в PauseCanvas
|
||||
DeathScreenBuilder.Build();
|
||||
|
||||
// Сохраняем сцену геймплея
|
||||
EditorSceneManager.SaveScene(gameplayScene);
|
||||
Debug.Log("[PauseMenuBuilder] PauseMenu успешно добавлен в SampleScene.unity");
|
||||
|
||||
Reference in new issue
Block a user