меню паузы, механика записок и лифта
This commit is contained in:
1 parent
cbda26dfc0
commit
cdd1055fd8
55 files changed
+3860
-1087
No files matched your search
+7
-7
@@ -115,11 +115,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -162,9 +162,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -99,11 +99,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -144,9 +144,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -100,11 +100,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -147,9 +147,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -115,11 +115,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -162,9 +162,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -102,11 +102,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -149,9 +149,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
+7
-7
@@ -101,11 +101,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -148,9 +148,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
@@ -72,11 +72,11 @@ Material:
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _FresnelPower: 2.5
|
||||
- _FresnelStrength: 0.4
|
||||
@@ -110,9 +110,9 @@ Material:
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
@@ -62,11 +62,11 @@ Material:
|
||||
- _CloudBandWidth: 3.2
|
||||
- _ColorRevealIntensity: 1.6
|
||||
- _ColorRevealSharpness: 1
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _FresnelPower: 2.5
|
||||
- _FresnelStrength: 0.4
|
||||
@@ -87,9 +87,9 @@ Material:
|
||||
- _BaseColor: {r: 0.015, g: 0.015, b: 0.02, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Отображает текущий статус найденных цифр кода лифта на игровом экране (HUD).
|
||||
/// Например: "КОД ЛИФТА: [ 7 ] [ ? ] [ 1 ] [ ? ]"
|
||||
/// </summary>
|
||||
public class CodeHUDTracker : MonoBehaviour
|
||||
{
|
||||
private static CodeHUDTracker _instance;
|
||||
public static CodeHUDTracker Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<CodeHUDTracker>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Слоты для цифр")]
|
||||
[SerializeField] private Text[] digitSlotTexts = new Text[4];
|
||||
[SerializeField] private Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
[Header("Цвета")]
|
||||
public Color discoveredTextColor = new Color(1.0f, 0.85f, 0.1f, 1.0f); // Ярко-золотой
|
||||
public Color undiscoveredTextColor = new Color(0.45f, 0.45f, 0.45f, 0.7f); // Серый
|
||||
public Color discoveredBorderColor = new Color(1.0f, 0.85f, 0.1f, 0.8f);
|
||||
public Color undiscoveredBorderColor = new Color(0.3f, 0.3f, 0.3f, 0.4f);
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnDigitDiscovered += HandleDigitDiscovered;
|
||||
}
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnDigitDiscovered -= HandleDigitDiscovered;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleDigitDiscovered(int pos, int val)
|
||||
{
|
||||
RefreshDisplay();
|
||||
}
|
||||
|
||||
public void RefreshDisplay()
|
||||
{
|
||||
if (LevelCodeManager.Instance == null) return;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
bool isDiscovered = LevelCodeManager.Instance.IsDigitDiscovered(i);
|
||||
int digit = LevelCodeManager.Instance.GetDigit(i);
|
||||
|
||||
if (digitSlotTexts != null && i < digitSlotTexts.Length && digitSlotTexts[i] != null)
|
||||
{
|
||||
digitSlotTexts[i].text = isDiscovered ? digit.ToString() : "?";
|
||||
digitSlotTexts[i].color = isDiscovered ? discoveredTextColor : undiscoveredTextColor;
|
||||
}
|
||||
|
||||
if (digitSlotBorders != null && i < digitSlotBorders.Length && digitSlotBorders[i] != null)
|
||||
{
|
||||
digitSlotBorders[i].color = isDiscovered ? discoveredBorderColor : undiscoveredBorderColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f520b1196771b924287149561be1ad81
|
||||
@@ -226,10 +226,10 @@ public class EchoTrigger : MonoBehaviour
|
||||
|
||||
void HandleManualEchoPulse()
|
||||
{
|
||||
// Возможность выпустить эхолокационный импульс (Space, E, Q или ПКМ)
|
||||
// Возможность выпустить эхолокационный импульс (Space, Q или ПКМ)
|
||||
var keyboard = Keyboard.current;
|
||||
var mouse = Mouse.current;
|
||||
bool pulseKey = (keyboard != null && (keyboard.spaceKey.wasPressedThisFrame || keyboard.eKey.wasPressedThisFrame || keyboard.qKey.wasPressedThisFrame))
|
||||
bool pulseKey = (keyboard != null && (keyboard.spaceKey.wasPressedThisFrame || keyboard.qKey.wasPressedThisFrame))
|
||||
|| (mouse != null && mouse.rightButton.wasPressedThisFrame);
|
||||
|
||||
if (pulseKey)
|
||||
|
||||
@@ -0,0 +1,994 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
public static class LevelStoryBuilder
|
||||
{
|
||||
private static Font defaultUiFont;
|
||||
private static Font handwrittenFont;
|
||||
private static Material echoMat;
|
||||
|
||||
[MenuItem("Tools/Build Level Story System (Elevator + Notes)")]
|
||||
public static void Build()
|
||||
{
|
||||
Debug.Log("<color=cyan>=== СБОРКА СЮЖЕТНОЙ СИСТЕМЫ: ЛИФТ И 4 ЗАПИСКИ С КОДОМ ===</color>");
|
||||
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogError("Нельзя запускать сборку во время Play Mode! Остановите игру.");
|
||||
return;
|
||||
}
|
||||
|
||||
defaultUiFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (defaultUiFont == null) defaultUiFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/SegoeScriptBold.ttf");
|
||||
if (handwrittenFont == null) handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
||||
if (handwrittenFont == null) handwrittenFont = defaultUiFont;
|
||||
|
||||
echoMat = AssetDatabase.LoadAssetAtPath<Material>("Assets/EchoCloudMat.mat");
|
||||
if (echoMat == null) echoMat = AssetDatabase.LoadAssetAtPath<Material>("Assets/EchoMat.mat");
|
||||
|
||||
// Убеждаемся, что у игрока стоит тег Player
|
||||
var player = GameObject.Find("Player");
|
||||
if (player != null)
|
||||
{
|
||||
player.tag = "Player";
|
||||
EditorUtility.SetDirty(player);
|
||||
}
|
||||
|
||||
// 1. Создаем или находим StoryManager (LevelCodeManager)
|
||||
SetupStoryManager();
|
||||
|
||||
// 2. Создаем 3D-зону лифта и терминал
|
||||
SetupElevatorPlatformAndTerminal();
|
||||
|
||||
// 3. Создаем 4 записки в разных комнатах лаборатории
|
||||
SetupFourStoryNotes();
|
||||
|
||||
// 4. Добавляем в HUD_Canvas весь UI
|
||||
SetupStoryUIInHUDCanvas();
|
||||
|
||||
// Сохраняем сцену
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
EditorSceneManager.SaveOpenScenes();
|
||||
|
||||
Debug.Log("<color=green>=== СЮЖЕТНАЯ СИСТЕМА УСПЕШНО СОБРАНА И СОХРАНЕНА! ===</color>");
|
||||
}
|
||||
|
||||
private static void SetupStoryManager()
|
||||
{
|
||||
var existing = Object.FindAnyObjectByType<LevelCodeManager>();
|
||||
if (existing == null)
|
||||
{
|
||||
var go = new GameObject("StoryManager");
|
||||
Undo.RegisterCreatedObjectUndo(go, "Create StoryManager");
|
||||
go.AddComponent<LevelCodeManager>();
|
||||
Debug.Log("<color=yellow>[LevelStoryBuilder] Создан объект StoryManager с LevelCodeManager.</color>");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupElevatorPlatformAndTerminal()
|
||||
{
|
||||
var oldElevator = GameObject.Find("Elevator_Level2_Zone");
|
||||
if (oldElevator != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldElevator);
|
||||
}
|
||||
|
||||
GameObject elevatorRoot = new GameObject("Elevator_Level2_Zone");
|
||||
Undo.RegisterCreatedObjectUndo(elevatorRoot, "Create Elevator_Level2_Zone");
|
||||
elevatorRoot.transform.position = new Vector3(0f, 0f, 45f);
|
||||
|
||||
// 1. Платформа лифта (6x6м на полу)
|
||||
GameObject platform = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
platform.name = "Elevator_Platform";
|
||||
platform.transform.SetParent(elevatorRoot.transform);
|
||||
platform.transform.localPosition = new Vector3(0f, 0.05f, 0f);
|
||||
platform.transform.localScale = new Vector3(6f, 0.1f, 6f);
|
||||
if (echoMat != null) platform.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
CreateElevatorFrame(elevatorRoot.transform);
|
||||
|
||||
// 2. Стойка терминала управления лифтом
|
||||
GameObject console = new GameObject("Elevator_Terminal_Console");
|
||||
console.transform.SetParent(elevatorRoot.transform);
|
||||
console.transform.localPosition = new Vector3(1.8f, 0f, -2.2f);
|
||||
console.transform.localRotation = Quaternion.Euler(0f, -35f, 0f);
|
||||
|
||||
GameObject stand = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
|
||||
stand.name = "Stand";
|
||||
stand.transform.SetParent(console.transform);
|
||||
stand.transform.localPosition = new Vector3(0f, 0.55f, 0f);
|
||||
stand.transform.localScale = new Vector3(0.2f, 0.55f, 0.2f);
|
||||
if (echoMat != null) stand.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject screenBox = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
screenBox.name = "ScreenBox";
|
||||
screenBox.transform.SetParent(console.transform);
|
||||
screenBox.transform.localPosition = new Vector3(0f, 1.15f, 0f);
|
||||
screenBox.transform.localRotation = Quaternion.Euler(30f, 0f, 0f);
|
||||
screenBox.transform.localScale = new Vector3(0.7f, 0.45f, 0.12f);
|
||||
if (echoMat != null) screenBox.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject lightGo = new GameObject("Terminal_StatusLight");
|
||||
lightGo.transform.SetParent(console.transform);
|
||||
lightGo.transform.localPosition = new Vector3(0f, 1.45f, 0f);
|
||||
Light statusLight = lightGo.AddComponent<Light>();
|
||||
statusLight.type = LightType.Point;
|
||||
statusLight.color = new Color(1f, 0.85f, 0.1f);
|
||||
statusLight.intensity = 2.5f;
|
||||
statusLight.range = 5.0f;
|
||||
|
||||
var terminalComp = console.AddComponent<ElevatorTerminal>();
|
||||
terminalComp.interactionDistance = 3.8f;
|
||||
terminalComp.statusLight = statusLight;
|
||||
terminalComp.screenRenderer = screenBox.GetComponent<MeshRenderer>();
|
||||
|
||||
CreateWorldText(console.transform, new Vector3(0f, 1.7f, 0f), "ТЕРМИНАЛ ЛИФТА\n[ВВЕДИТЕ 4 ЦИФРЫ]", new Color(1f, 0.85f, 0.1f), 0.035f);
|
||||
}
|
||||
|
||||
private static void CreateElevatorFrame(Transform parent)
|
||||
{
|
||||
Vector3[] corners = new Vector3[] {
|
||||
new Vector3(-2.9f, 2.25f, -2.9f),
|
||||
new Vector3(2.9f, 2.25f, -2.9f),
|
||||
new Vector3(-2.9f, 2.25f, 2.9f),
|
||||
new Vector3(2.9f, 2.25f, 2.9f)
|
||||
};
|
||||
|
||||
for (int i = 0; i < corners.Length; i++)
|
||||
{
|
||||
GameObject pillar = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
pillar.name = $"Pillar_{i}";
|
||||
pillar.transform.SetParent(parent);
|
||||
pillar.transform.localPosition = corners[i];
|
||||
pillar.transform.localScale = new Vector3(0.25f, 4.5f, 0.25f);
|
||||
if (echoMat != null) pillar.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
}
|
||||
|
||||
GameObject beam = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
beam.name = "Elevator_TopBeam";
|
||||
beam.transform.SetParent(parent);
|
||||
beam.transform.localPosition = new Vector3(0f, 4.3f, -2.9f);
|
||||
beam.transform.localScale = new Vector3(6f, 0.4f, 0.3f);
|
||||
if (echoMat != null) beam.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
CreateWorldText(parent, new Vector3(0f, 4.3f, -3.1f), "ВЫХОД: ЭВАКУАЦИОННЫЙ ЛИФТ (УРОВЕНЬ 2)", new Color(1f, 0.85f, 0.1f), 0.05f);
|
||||
}
|
||||
|
||||
private static void SetupFourStoryNotes()
|
||||
{
|
||||
var oldNotes = GameObject.Find("StoryNotes_Container");
|
||||
if (oldNotes != null)
|
||||
{
|
||||
Undo.DestroyObjectImmediate(oldNotes);
|
||||
}
|
||||
|
||||
GameObject notesRoot = new GameObject("StoryNotes_Container");
|
||||
Undo.RegisterCreatedObjectUndo(notesRoot, "Create StoryNotes_Container");
|
||||
|
||||
var noteDefs = new[]
|
||||
{
|
||||
new {
|
||||
pos = 0,
|
||||
coords = new Vector3(-36f, 0.85f, -36f),
|
||||
title = "ЗАПИСКА ДЕЖУРНОГО ТЕХНИКА #1",
|
||||
sector = "СЕКТОР B: КРИОГЕНИКА",
|
||||
text = "Срочное сообщение: система заблокировала шлюз из-за проникновения мутантов. Первую цифру кода аварийного лифта пришлось изменить, чтобы изолировать отсек. Запомните её, если хотите выбраться отсюда живым! Слепые твари не видят вас в темноте, пока вы стоите неподвижно."
|
||||
},
|
||||
new {
|
||||
pos = 1,
|
||||
coords = new Vector3(36f, 0.85f, -36f),
|
||||
title = "РАПОРТ СЛУЖБЫ БЕЗОПАСНОСТИ #2",
|
||||
sector = "СЕКТОР C: АРХИВ ОРУЖЕЙНОЙ",
|
||||
text = "Внимание личному составу: мутанты ориентируются исключительно на эхо шагов и грохот выстрелов! Вторая цифра защитного протокола лифта сохранена в этой директиве. Берегите патроны и используйте скрытное перемещение."
|
||||
},
|
||||
new {
|
||||
pos = 2,
|
||||
coords = new Vector3(-34f, 0.85f, -10f),
|
||||
title = "ДНЕВНИК ГЛАВНОГО БИОХИМИКА #3",
|
||||
sector = "СЕКТОР D: БИОХИМИЯ",
|
||||
text = "Эксперимент 'Эхо-11' полностью вышел из-под контроля. Все отсеки запечатаны. Третья цифра для активации транспортного лифта зафиксирована здесь. Если вы читаете это — немедленно прорывайтесь к реакторному залу на севере!"
|
||||
},
|
||||
new {
|
||||
pos = 3,
|
||||
coords = new Vector3(36f, 0.85f, 16f),
|
||||
title = "СЕРВЕРНЫЙ ЛОГ ЭНЕРГОСИСТЕМЫ #4",
|
||||
sector = "СЕКТОР G: ГЕНЕТИКА И КИБЕРНЕТИКА",
|
||||
text = "Автоматический протокол эвакуации: питание гидравлической шахты переведено на аварийный генератор. Финальная, четвертая цифра защитного кода записана в этот модуль. Транспортный лифт ожидает в северном крыле комплекса."
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var def in noteDefs)
|
||||
{
|
||||
CreateNoteObject(notesRoot.transform, def.pos, def.coords, def.title, def.sector, def.text);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateNoteObject(Transform parent, int digitPos, Vector3 position, string title, string sector, string text)
|
||||
{
|
||||
GameObject noteGo = new GameObject($"Note_Digit_{digitPos + 1}");
|
||||
noteGo.transform.SetParent(parent);
|
||||
noteGo.transform.position = position;
|
||||
|
||||
GameObject folder = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
folder.name = "FolderVisual";
|
||||
folder.transform.SetParent(noteGo.transform);
|
||||
folder.transform.localPosition = Vector3.zero;
|
||||
folder.transform.localRotation = Quaternion.Euler(0f, Random.Range(-30f, 30f), 0f);
|
||||
folder.transform.localScale = new Vector3(0.4f, 0.04f, 0.55f);
|
||||
if (echoMat != null) folder.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject paper = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
paper.name = "PaperSheet";
|
||||
paper.transform.SetParent(folder.transform);
|
||||
paper.transform.localPosition = new Vector3(0f, 0.55f, 0f);
|
||||
paper.transform.localScale = new Vector3(0.85f, 0.1f, 0.85f);
|
||||
if (echoMat != null) paper.GetComponent<MeshRenderer>().sharedMaterial = echoMat;
|
||||
|
||||
GameObject markerLight = new GameObject("NoteLight");
|
||||
markerLight.transform.SetParent(noteGo.transform);
|
||||
markerLight.transform.localPosition = new Vector3(0f, 0.4f, 0f);
|
||||
Light lightComp = markerLight.AddComponent<Light>();
|
||||
lightComp.type = LightType.Point;
|
||||
lightComp.color = new Color(1.0f, 0.85f, 0.1f);
|
||||
lightComp.intensity = 2.0f;
|
||||
lightComp.range = 3.5f;
|
||||
|
||||
NotePickup pickup = noteGo.AddComponent<NotePickup>();
|
||||
pickup.digitPosition = digitPos;
|
||||
pickup.noteTitle = title;
|
||||
pickup.sectorName = sector;
|
||||
pickup.storyText = text;
|
||||
pickup.interactionDistance = 3.6f;
|
||||
// 3D текстовая подсказка отключена по запросу пользователя (убрана желтая надпись НАЖМИТЕ [E])
|
||||
// CreateWorldText(noteGo.transform, new Vector3(0f, 0.7f, 0f), $"[ЗАПИСКА #{digitPos + 1}]\nНАЖМИТЕ [E]", new Color(1f, 0.85f, 0.1f), 0.025f);
|
||||
}
|
||||
|
||||
private static void CreateWorldText(Transform parent, Vector3 localPos, string text, Color color, float characterSize)
|
||||
{
|
||||
GameObject textGo = new GameObject("FloatingLabel");
|
||||
textGo.transform.SetParent(parent);
|
||||
textGo.transform.localPosition = localPos;
|
||||
TextMesh tm = textGo.AddComponent<TextMesh>();
|
||||
tm.text = text;
|
||||
tm.fontSize = 42;
|
||||
tm.characterSize = characterSize;
|
||||
tm.color = color;
|
||||
tm.alignment = TextAlignment.Center;
|
||||
tm.anchor = TextAnchor.MiddleCenter;
|
||||
tm.fontStyle = FontStyle.Bold;
|
||||
if (defaultUiFont != null) tm.font = defaultUiFont;
|
||||
}
|
||||
|
||||
private static void SetupStoryUIInHUDCanvas()
|
||||
{
|
||||
GameObject hudCanvasGo = GameObject.Find("HUD_Canvas");
|
||||
if (hudCanvasGo == null)
|
||||
{
|
||||
hudCanvasGo = new GameObject("HUD_Canvas");
|
||||
Canvas c = hudCanvasGo.AddComponent<Canvas>();
|
||||
c.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
hudCanvasGo.AddComponent<CanvasScaler>();
|
||||
hudCanvasGo.AddComponent<GraphicRaycaster>();
|
||||
}
|
||||
|
||||
Transform hudRoot = hudCanvasGo.transform;
|
||||
|
||||
SetupInteractionPrompt(hudRoot);
|
||||
SetupCodeHUDTracker(hudRoot);
|
||||
SetupNoteViewerPanel(hudRoot);
|
||||
SetupElevatorKeypadPanel(hudRoot);
|
||||
SetupLevelSuccessPanel(hudRoot);
|
||||
}
|
||||
|
||||
private static void SetupInteractionPrompt(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("InteractionPromptPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
}
|
||||
|
||||
private static void SetupCodeHUDTracker(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("CodeTrackerHUD");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject trackerObj = new GameObject("CodeTrackerHUD");
|
||||
trackerObj.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rt = trackerObj.AddComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(1.0f, 1.0f);
|
||||
rt.anchorMax = new Vector2(1.0f, 1.0f);
|
||||
rt.pivot = new Vector2(1.0f, 1.0f);
|
||||
rt.anchoredPosition = new Vector2(-25f, -25f);
|
||||
rt.sizeDelta = new Vector2(260f, 68f);
|
||||
|
||||
Image bg = trackerObj.AddComponent<Image>();
|
||||
bg.color = new Color(0.04f, 0.04f, 0.04f, 0.88f);
|
||||
|
||||
Outline outline = trackerObj.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(1.0f, 0.85f, 0.1f, 0.5f);
|
||||
outline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject labelObj = new GameObject("Label");
|
||||
labelObj.transform.SetParent(trackerObj.transform, false);
|
||||
RectTransform labelRt = labelObj.AddComponent<RectTransform>();
|
||||
labelRt.anchorMin = new Vector2(0f, 0.6f);
|
||||
labelRt.anchorMax = new Vector2(1f, 1f);
|
||||
labelRt.offsetMin = new Vector2(10f, 0f);
|
||||
labelRt.offsetMax = new Vector2(-10f, -4f);
|
||||
|
||||
Text labelTxt = labelObj.AddComponent<Text>();
|
||||
labelTxt.font = defaultUiFont;
|
||||
labelTxt.fontSize = 13;
|
||||
labelTxt.fontStyle = FontStyle.Bold;
|
||||
labelTxt.alignment = TextAnchor.MiddleCenter;
|
||||
labelTxt.color = new Color(1.0f, 0.85f, 0.1f, 0.9f);
|
||||
labelTxt.text = "КОД ЛИФТА (УРОВЕНЬ 2):";
|
||||
|
||||
Text[] slotTexts = new Text[4];
|
||||
Image[] slotBorders = new Image[4];
|
||||
|
||||
float startX = 25f;
|
||||
float spacing = 55f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GameObject slotObj = new GameObject($"Slot_{i}");
|
||||
slotObj.transform.SetParent(trackerObj.transform, false);
|
||||
|
||||
RectTransform slotRt = slotObj.AddComponent<RectTransform>();
|
||||
slotRt.anchorMin = new Vector2(0f, 0f);
|
||||
slotRt.anchorMax = new Vector2(0f, 0.6f);
|
||||
slotRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
slotRt.anchoredPosition = new Vector2(startX + i * spacing + 20f, 20f);
|
||||
slotRt.sizeDelta = new Vector2(42f, 32f);
|
||||
|
||||
Image slotBg = slotObj.AddComponent<Image>();
|
||||
slotBg.color = new Color(0.08f, 0.08f, 0.08f, 0.95f);
|
||||
slotBorders[i] = slotBg;
|
||||
|
||||
Outline slotOutline = slotObj.AddComponent<Outline>();
|
||||
slotOutline.effectColor = new Color(0.3f, 0.3f, 0.3f, 0.5f);
|
||||
slotOutline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(slotObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text st = txtObj.AddComponent<Text>();
|
||||
st.font = handwrittenFont;
|
||||
st.fontSize = 20;
|
||||
st.fontStyle = FontStyle.Bold;
|
||||
st.alignment = TextAnchor.MiddleCenter;
|
||||
st.color = new Color(0.45f, 0.45f, 0.45f, 0.7f);
|
||||
st.text = "?";
|
||||
slotTexts[i] = st;
|
||||
}
|
||||
|
||||
var trackerComp = trackerObj.AddComponent<CodeHUDTracker>();
|
||||
SetField(trackerComp, "digitSlotTexts", slotTexts);
|
||||
SetField(trackerComp, "digitSlotBorders", slotBorders);
|
||||
}
|
||||
|
||||
private static void SetupNoteViewerPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("NoteViewerPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
var tornPaperSprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/Textures/TornPaper_Sprite.png");
|
||||
var inkFreeFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
||||
var courierFont = Font.CreateDynamicFontFromOSFont("Courier New", 18);
|
||||
if (courierFont == null) courierFont = Font.CreateDynamicFontFromOSFont("Consolas", 18);
|
||||
if (courierFont == null) courierFont = defaultUiFont;
|
||||
|
||||
GameObject rootPanel = new GameObject("NoteViewerPanel", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button));
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.GetComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.GetComponent<Image>();
|
||||
overlay.color = new Color(0.02f, 0.02f, 0.03f, 0.82f);
|
||||
|
||||
Button overlayBtn = rootPanel.GetComponent<Button>();
|
||||
overlayBtn.transition = Selectable.Transition.None;
|
||||
|
||||
GameObject shadowObj = new GameObject("PaperShadow", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
shadowObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform shadowRt = shadowObj.GetComponent<RectTransform>();
|
||||
shadowRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
shadowRt.anchoredPosition = new Vector2(8f, 12f);
|
||||
shadowRt.sizeDelta = new Vector2(635f, 635f);
|
||||
Image shadowImg = shadowObj.GetComponent<Image>();
|
||||
if (tornPaperSprite != null) shadowImg.sprite = tornPaperSprite;
|
||||
shadowImg.color = new Color(0f, 0f, 0f, 0.45f);
|
||||
|
||||
GameObject paperObj = new GameObject("NoteDocumentCard", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
paperObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform paperRt = paperObj.GetComponent<RectTransform>();
|
||||
paperRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
paperRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
paperRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
paperRt.anchoredPosition = new Vector2(0f, 20f);
|
||||
paperRt.sizeDelta = new Vector2(620f, 620f);
|
||||
|
||||
Image paperImg = paperObj.GetComponent<Image>();
|
||||
if (tornPaperSprite != null) paperImg.sprite = tornPaperSprite;
|
||||
paperImg.color = Color.white;
|
||||
|
||||
paperObj.transform.localRotation = Quaternion.Euler(0f, 0f, -1.2f);
|
||||
shadowObj.transform.localRotation = paperObj.transform.localRotation;
|
||||
|
||||
GameObject headerObj = new GameObject("DocumentHeader", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
headerObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform headerRt = headerObj.GetComponent<RectTransform>();
|
||||
headerRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
headerRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
headerRt.pivot = new Vector2(0.5f, 1f);
|
||||
headerRt.anchoredPosition = new Vector2(0f, -65f);
|
||||
headerRt.sizeDelta = new Vector2(450f, 32f);
|
||||
|
||||
Text headerTxt = headerObj.GetComponent<Text>();
|
||||
headerTxt.font = courierFont;
|
||||
headerTxt.fontSize = 24;
|
||||
headerTxt.fontStyle = FontStyle.Bold;
|
||||
headerTxt.alignment = TextAnchor.MiddleCenter;
|
||||
headerTxt.color = new Color(0.12f, 0.12f, 0.14f, 1.0f);
|
||||
headerTxt.text = "Секретный протокол";
|
||||
|
||||
GameObject ellipsisObj = new GameObject("EllipsisText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
ellipsisObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform ellipsisRt = ellipsisObj.GetComponent<RectTransform>();
|
||||
ellipsisRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.pivot = new Vector2(0.5f, 1f);
|
||||
ellipsisRt.anchoredPosition = new Vector2(0f, -94f);
|
||||
ellipsisRt.sizeDelta = new Vector2(450f, 22f);
|
||||
|
||||
Text ellipsisTxt = ellipsisObj.GetComponent<Text>();
|
||||
ellipsisTxt.font = courierFont;
|
||||
ellipsisTxt.fontSize = 18;
|
||||
ellipsisTxt.alignment = TextAnchor.MiddleCenter;
|
||||
ellipsisTxt.color = new Color(0.35f, 0.35f, 0.38f, 0.85f);
|
||||
ellipsisTxt.text = ". . .";
|
||||
|
||||
GameObject sectorObj = new GameObject("SectorText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
sectorObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform sectorRt = sectorObj.GetComponent<RectTransform>();
|
||||
sectorRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
sectorRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
sectorRt.pivot = new Vector2(0.5f, 1f);
|
||||
sectorRt.anchoredPosition = new Vector2(0f, -120f);
|
||||
sectorRt.sizeDelta = new Vector2(440f, 22f);
|
||||
|
||||
Text sectorTxt = sectorObj.GetComponent<Text>();
|
||||
sectorTxt.font = courierFont;
|
||||
sectorTxt.fontSize = 12;
|
||||
sectorTxt.fontStyle = FontStyle.Bold;
|
||||
sectorTxt.alignment = TextAnchor.MiddleCenter;
|
||||
sectorTxt.color = new Color(0.38f, 0.38f, 0.42f, 0.9f);
|
||||
sectorTxt.text = "ОТДЕЛ: СЕКТОР B // КРИОГЕНИКА";
|
||||
|
||||
GameObject storyObj = new GameObject("StoryText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
storyObj.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform storyRt = storyObj.GetComponent<RectTransform>();
|
||||
storyRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
storyRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
storyRt.pivot = new Vector2(0.5f, 1f);
|
||||
storyRt.anchoredPosition = new Vector2(0f, -148f);
|
||||
storyRt.sizeDelta = new Vector2(430f, 160f);
|
||||
|
||||
Text storyTxt = storyObj.GetComponent<Text>();
|
||||
storyTxt.font = courierFont;
|
||||
storyTxt.fontSize = 13;
|
||||
storyTxt.alignment = TextAnchor.UpperLeft;
|
||||
storyTxt.lineSpacing = 1.18f;
|
||||
storyTxt.color = new Color(0.18f, 0.18f, 0.22f, 1.0f);
|
||||
storyTxt.text = "Срочное сообщение: система заблокировала шлюз из-за проникновения мутантов. Первую цифру кода аварийного лифта пришлось изменить, чтобы изолировать отсек. Запомните её, если хотите выбраться отсюда живым!";
|
||||
|
||||
GameObject codeArea = new GameObject("PaperCodeArea", typeof(RectTransform));
|
||||
codeArea.transform.SetParent(paperObj.transform, false);
|
||||
RectTransform codeRt = codeArea.GetComponent<RectTransform>();
|
||||
codeRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
codeRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
codeRt.pivot = new Vector2(0.5f, 1f);
|
||||
codeRt.anchoredPosition = new Vector2(0f, -320f);
|
||||
codeRt.sizeDelta = new Vector2(440f, 150f);
|
||||
|
||||
GameObject posObj = new GameObject("PositionText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
posObj.transform.SetParent(codeArea.transform, false);
|
||||
RectTransform posRt = posObj.GetComponent<RectTransform>();
|
||||
posRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
posRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
posRt.pivot = new Vector2(0.5f, 1f);
|
||||
posRt.anchoredPosition = new Vector2(0f, 0f);
|
||||
posRt.sizeDelta = new Vector2(440f, 26f);
|
||||
|
||||
Text posTxt = posObj.GetComponent<Text>();
|
||||
posTxt.font = courierFont;
|
||||
posTxt.fontSize = 13;
|
||||
posTxt.fontStyle = FontStyle.Bold;
|
||||
posTxt.alignment = TextAnchor.MiddleCenter;
|
||||
posTxt.color = new Color(0.25f, 0.25f, 0.30f, 1.0f);
|
||||
posTxt.text = "ПОЗИЦИЯ В КОДЕ ЛИФТА: 1-Я ЦИФРА [ _ * * * ]";
|
||||
|
||||
GameObject digitObj = new GameObject("BigDigitText", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
digitObj.transform.SetParent(codeArea.transform, false);
|
||||
RectTransform digitRt = digitObj.GetComponent<RectTransform>();
|
||||
digitRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
digitRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
digitRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
digitRt.anchoredPosition = new Vector2(0f, -25f);
|
||||
digitRt.sizeDelta = new Vector2(160f, 110f);
|
||||
|
||||
Text digitTxt = digitObj.GetComponent<Text>();
|
||||
digitTxt.font = inkFreeFont != null ? inkFreeFont : courierFont;
|
||||
digitTxt.fontSize = 82;
|
||||
digitTxt.fontStyle = FontStyle.Bold;
|
||||
digitTxt.alignment = TextAnchor.MiddleCenter;
|
||||
digitTxt.color = new Color(0.06f, 0.16f, 0.52f, 1.0f);
|
||||
digitTxt.text = "7";
|
||||
|
||||
GameObject hintObj = new GameObject("CloseHint", typeof(RectTransform), typeof(CanvasRenderer), typeof(Text));
|
||||
hintObj.transform.SetParent(rootPanel.transform, false);
|
||||
RectTransform hintRt = hintObj.GetComponent<RectTransform>();
|
||||
hintRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
hintRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
hintRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
hintRt.anchoredPosition = new Vector2(0f, -325f);
|
||||
hintRt.sizeDelta = new Vector2(600f, 32f);
|
||||
|
||||
Text hintTxt = hintObj.GetComponent<Text>();
|
||||
hintTxt.font = courierFont;
|
||||
hintTxt.fontSize = 13;
|
||||
hintTxt.alignment = TextAnchor.MiddleCenter;
|
||||
hintTxt.color = new Color(0.85f, 0.85f, 0.85f, 0.70f);
|
||||
hintTxt.text = "[ НАЖМИТЕ E, ESC ИЛИ КЛИКНИТЕ, ЧТОБЫ ЗАКРЫТЬ ]";
|
||||
|
||||
var noteViewerComp = rootPanel.AddComponent<NoteViewerUI>();
|
||||
SetField(noteViewerComp, "notePanelRoot", rootPanel);
|
||||
SetField(noteViewerComp, "documentHeader", headerTxt);
|
||||
SetField(noteViewerComp, "sectorText", sectorTxt);
|
||||
SetField(noteViewerComp, "positionNoticeText", posTxt);
|
||||
SetField(noteViewerComp, "bigDigitText", digitTxt);
|
||||
SetField(noteViewerComp, "flavorBodyText", storyTxt);
|
||||
SetField(noteViewerComp, "closeButton", overlayBtn);
|
||||
|
||||
overlayBtn.onClick.RemoveAllListeners();
|
||||
overlayBtn.onClick.AddListener(noteViewerComp.CloseNote);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static void SetupElevatorKeypadPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("ElevatorKeypadPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject rootPanel = new GameObject("ElevatorKeypadPanel");
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.AddComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.AddComponent<Image>();
|
||||
overlay.color = new Color(0f, 0f, 0f, 0.9f);
|
||||
|
||||
GameObject card = new GameObject("TerminalCard");
|
||||
card.transform.SetParent(rootPanel.transform, false);
|
||||
|
||||
RectTransform cardRt = card.AddComponent<RectTransform>();
|
||||
cardRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
cardRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
cardRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
cardRt.sizeDelta = new Vector2(560f, 660f);
|
||||
|
||||
Image cardBg = card.AddComponent<Image>();
|
||||
cardBg.color = new Color(0.04f, 0.04f, 0.04f, 0.98f);
|
||||
|
||||
Outline cardOutline = card.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.8f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
GameObject headerObj = new GameObject("Title");
|
||||
headerObj.transform.SetParent(card.transform, false);
|
||||
RectTransform headerRt = headerObj.AddComponent<RectTransform>();
|
||||
headerRt.anchorMin = new Vector2(0f, 1f);
|
||||
headerRt.anchorMax = new Vector2(1f, 1f);
|
||||
headerRt.pivot = new Vector2(0.5f, 1f);
|
||||
headerRt.anchoredPosition = new Vector2(0f, -20f);
|
||||
headerRt.sizeDelta = new Vector2(520f, 36f);
|
||||
|
||||
Text headerTxt = headerObj.AddComponent<Text>();
|
||||
headerTxt.font = defaultUiFont;
|
||||
headerTxt.fontSize = 18;
|
||||
headerTxt.fontStyle = FontStyle.Bold;
|
||||
headerTxt.alignment = TextAnchor.MiddleCenter;
|
||||
headerTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
headerTxt.text = "ТЕРМИНАЛ ЛИФТА // ВЫХОД НА УРОВЕНЬ 2";
|
||||
|
||||
GameObject displayBox = new GameObject("DisplayBox");
|
||||
displayBox.transform.SetParent(card.transform, false);
|
||||
RectTransform displayRt = displayBox.AddComponent<RectTransform>();
|
||||
displayRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
displayRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
displayRt.pivot = new Vector2(0.5f, 1f);
|
||||
displayRt.anchoredPosition = new Vector2(0f, -70f);
|
||||
displayRt.sizeDelta = new Vector2(460f, 85f);
|
||||
|
||||
Image dispBg = displayBox.AddComponent<Image>();
|
||||
dispBg.color = new Color(0.01f, 0.01f, 0.01f, 1.0f);
|
||||
|
||||
Outline dispOutline = displayBox.AddComponent<Outline>();
|
||||
dispOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.4f);
|
||||
dispOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Text[] digitSlots = new Text[4];
|
||||
Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
float slotStartX = -150f;
|
||||
float slotSpacing = 100f;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
GameObject sObj = new GameObject($"DigitSlot_{i}");
|
||||
sObj.transform.SetParent(displayBox.transform, false);
|
||||
|
||||
RectTransform sRt = sObj.AddComponent<RectTransform>();
|
||||
sRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
sRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
sRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
sRt.anchoredPosition = new Vector2(slotStartX + i * slotSpacing, 0f);
|
||||
sRt.sizeDelta = new Vector2(75f, 65f);
|
||||
|
||||
Image sBg = sObj.AddComponent<Image>();
|
||||
sBg.color = new Color(0.06f, 0.06f, 0.06f, 1.0f);
|
||||
digitSlotBorders[i] = sBg;
|
||||
|
||||
Outline sOutline = sObj.AddComponent<Outline>();
|
||||
sOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.3f);
|
||||
sOutline.effectDistance = new Vector2(1f, -1f);
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(sObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text st = txtObj.AddComponent<Text>();
|
||||
st.font = defaultUiFont;
|
||||
st.fontSize = 42;
|
||||
st.fontStyle = FontStyle.Bold;
|
||||
st.alignment = TextAnchor.MiddleCenter;
|
||||
st.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
st.text = "_";
|
||||
digitSlots[i] = st;
|
||||
}
|
||||
|
||||
GameObject statusObj = new GameObject("StatusText");
|
||||
statusObj.transform.SetParent(card.transform, false);
|
||||
RectTransform statusRt = statusObj.AddComponent<RectTransform>();
|
||||
statusRt.anchorMin = new Vector2(0.5f, 1f);
|
||||
statusRt.anchorMax = new Vector2(0.5f, 1f);
|
||||
statusRt.pivot = new Vector2(0.5f, 1f);
|
||||
statusRt.anchoredPosition = new Vector2(0f, -170f);
|
||||
statusRt.sizeDelta = new Vector2(500f, 32f);
|
||||
|
||||
Text statusTxt = statusObj.AddComponent<Text>();
|
||||
statusTxt.font = defaultUiFont;
|
||||
statusTxt.fontSize = 15;
|
||||
statusTxt.fontStyle = FontStyle.Bold;
|
||||
statusTxt.alignment = TextAnchor.MiddleCenter;
|
||||
statusTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
statusTxt.text = "ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД С ЗАПИСОК";
|
||||
|
||||
GameObject keypadGrid = new GameObject("KeypadGrid");
|
||||
keypadGrid.transform.SetParent(card.transform, false);
|
||||
RectTransform gridRt = keypadGrid.AddComponent<RectTransform>();
|
||||
gridRt.anchorMin = new Vector2(0.5f, 0f);
|
||||
gridRt.anchorMax = new Vector2(0.5f, 0f);
|
||||
gridRt.pivot = new Vector2(0.5f, 0f);
|
||||
gridRt.anchoredPosition = new Vector2(0f, 90f);
|
||||
gridRt.sizeDelta = new Vector2(390f, 340f);
|
||||
|
||||
Button[] numberButtons = new Button[10];
|
||||
Button clearButton = null;
|
||||
Button enterButton = null;
|
||||
|
||||
float btnW = 115f;
|
||||
float btnH = 68f;
|
||||
float[] xs = new float[] { -130f, 0f, 130f };
|
||||
|
||||
int[][] layout = new int[][]
|
||||
{
|
||||
new int[] { 1, 2, 3 },
|
||||
new int[] { 4, 5, 6 },
|
||||
new int[] { 7, 8, 9 }
|
||||
};
|
||||
|
||||
for (int r = 0; r < 3; r++)
|
||||
{
|
||||
float yPos = 255f - r * 85f;
|
||||
for (int c = 0; c < 3; c++)
|
||||
{
|
||||
int val = layout[r][c];
|
||||
numberButtons[val] = CreateKeypadButton(keypadGrid.transform, xs[c], yPos, btnW, btnH, val.ToString(),
|
||||
new Color(0.12f, 0.12f, 0.12f, 1f), new Color(1f, 0.85f, 0.1f, 1f));
|
||||
}
|
||||
}
|
||||
|
||||
clearButton = CreateKeypadButton(keypadGrid.transform, xs[0], 0f, btnW, btnH, "СБРОС",
|
||||
new Color(0.35f, 0.08f, 0.08f, 1f), new Color(1f, 0.4f, 0.4f, 1f));
|
||||
|
||||
numberButtons[0] = CreateKeypadButton(keypadGrid.transform, xs[1], 0f, btnW, btnH, "0",
|
||||
new Color(0.12f, 0.12f, 0.12f, 1f), new Color(1f, 0.85f, 0.1f, 1f));
|
||||
|
||||
enterButton = CreateKeypadButton(keypadGrid.transform, xs[2], 0f, btnW, btnH, "ВВОД",
|
||||
new Color(1.0f, 0.85f, 0.1f, 1f), new Color(0.05f, 0.05f, 0.05f, 1f));
|
||||
|
||||
GameObject exitObj = new GameObject("ExitButton");
|
||||
exitObj.transform.SetParent(card.transform, false);
|
||||
RectTransform exitRt = exitObj.AddComponent<RectTransform>();
|
||||
exitRt.anchorMin = new Vector2(0.5f, 0f);
|
||||
exitRt.anchorMax = new Vector2(0.5f, 0f);
|
||||
exitRt.pivot = new Vector2(0.5f, 0f);
|
||||
exitRt.anchoredPosition = new Vector2(0f, 25f);
|
||||
exitRt.sizeDelta = new Vector2(390f, 44f);
|
||||
|
||||
Image exitImg = exitObj.AddComponent<Image>();
|
||||
exitImg.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
||||
|
||||
Outline exitOutline = exitObj.AddComponent<Outline>();
|
||||
exitOutline.effectColor = new Color(0.5f, 0.5f, 0.5f, 0.6f);
|
||||
exitOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button exitBtn = exitObj.AddComponent<Button>();
|
||||
|
||||
GameObject exitTxtObj = new GameObject("Text");
|
||||
exitTxtObj.transform.SetParent(exitObj.transform, false);
|
||||
RectTransform exitTxtRt = exitTxtObj.AddComponent<RectTransform>();
|
||||
exitTxtRt.anchorMin = Vector2.zero;
|
||||
exitTxtRt.anchorMax = Vector2.one;
|
||||
exitTxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text etxt = exitTxtObj.AddComponent<Text>();
|
||||
etxt.font = defaultUiFont;
|
||||
etxt.fontSize = 15;
|
||||
etxt.fontStyle = FontStyle.Bold;
|
||||
etxt.alignment = TextAnchor.MiddleCenter;
|
||||
etxt.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
etxt.text = "ОТОЙТИ ОТ ТЕРМИНАЛА [ESC]";
|
||||
|
||||
var keypadComp = rootPanel.AddComponent<ElevatorKeypadUI>();
|
||||
SetField(keypadComp, "keypadPanelRoot", rootPanel);
|
||||
SetField(keypadComp, "digitSlots", digitSlots);
|
||||
SetField(keypadComp, "digitSlotBorders", digitSlotBorders);
|
||||
SetField(keypadComp, "statusText", statusTxt);
|
||||
SetField(keypadComp, "numberButtons", numberButtons);
|
||||
SetField(keypadComp, "clearButton", clearButton);
|
||||
SetField(keypadComp, "enterButton", enterButton);
|
||||
SetField(keypadComp, "exitButton", exitBtn);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static Button CreateKeypadButton(Transform parent, float x, float y, float w, float h, string text, Color bgColor, Color textColor)
|
||||
{
|
||||
GameObject btnObj = new GameObject($"Btn_{text}");
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
RectTransform rt = btnObj.AddComponent<RectTransform>();
|
||||
rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
rt.pivot = new Vector2(0.5f, 0f);
|
||||
rt.anchoredPosition = new Vector2(x, y);
|
||||
rt.sizeDelta = new Vector2(w, h);
|
||||
|
||||
Image bg = btnObj.AddComponent<Image>();
|
||||
bg.color = bgColor;
|
||||
|
||||
Outline outline = btnObj.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.45f);
|
||||
outline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button btn = btnObj.AddComponent<Button>();
|
||||
ColorBlock cb = btn.colors;
|
||||
cb.normalColor = bgColor;
|
||||
cb.highlightedColor = bgColor + new Color(0.15f, 0.15f, 0.15f, 0f);
|
||||
cb.pressedColor = bgColor - new Color(0.1f, 0.1f, 0.1f, 0f);
|
||||
btn.colors = cb;
|
||||
|
||||
GameObject txtObj = new GameObject("Text");
|
||||
txtObj.transform.SetParent(btnObj.transform, false);
|
||||
RectTransform txtRt = txtObj.AddComponent<RectTransform>();
|
||||
txtRt.anchorMin = Vector2.zero;
|
||||
txtRt.anchorMax = Vector2.one;
|
||||
txtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text txt = txtObj.AddComponent<Text>();
|
||||
txt.font = defaultUiFont;
|
||||
txt.fontSize = (text.Length > 2) ? 17 : 26;
|
||||
txt.fontStyle = FontStyle.Bold;
|
||||
txt.alignment = TextAnchor.MiddleCenter;
|
||||
txt.color = textColor;
|
||||
txt.text = text;
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
private static void SetupLevelSuccessPanel(Transform hudRoot)
|
||||
{
|
||||
var old = hudRoot.Find("LevelSuccessPanel");
|
||||
if (old != null) Undo.DestroyObjectImmediate(old.gameObject);
|
||||
|
||||
GameObject rootPanel = new GameObject("LevelSuccessPanel");
|
||||
rootPanel.transform.SetParent(hudRoot, false);
|
||||
|
||||
RectTransform rootRt = rootPanel.AddComponent<RectTransform>();
|
||||
rootRt.anchorMin = Vector2.zero;
|
||||
rootRt.anchorMax = Vector2.one;
|
||||
rootRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Image overlay = rootPanel.AddComponent<Image>();
|
||||
overlay.color = new Color(0f, 0f, 0f, 0.92f);
|
||||
|
||||
GameObject card = new GameObject("SuccessCard");
|
||||
card.transform.SetParent(rootPanel.transform, false);
|
||||
|
||||
RectTransform cardRt = card.AddComponent<RectTransform>();
|
||||
cardRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
cardRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
cardRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
cardRt.sizeDelta = new Vector2(650f, 440f);
|
||||
|
||||
Image cardBg = card.AddComponent<Image>();
|
||||
cardBg.color = new Color(0.04f, 0.04f, 0.04f, 0.98f);
|
||||
|
||||
Outline cardOutline = card.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.0f, 0.85f, 0.10f, 0.9f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
GameObject titleObj = new GameObject("Title");
|
||||
titleObj.transform.SetParent(card.transform, false);
|
||||
RectTransform titleRt = titleObj.AddComponent<RectTransform>();
|
||||
titleRt.anchorMin = new Vector2(0f, 1f);
|
||||
titleRt.anchorMax = new Vector2(1f, 1f);
|
||||
titleRt.pivot = new Vector2(0.5f, 1f);
|
||||
titleRt.anchoredPosition = new Vector2(0f, -30f);
|
||||
titleRt.sizeDelta = new Vector2(600f, 45f);
|
||||
|
||||
Text titleTxt = titleObj.AddComponent<Text>();
|
||||
titleTxt.font = defaultUiFont;
|
||||
titleTxt.fontSize = 32;
|
||||
titleTxt.fontStyle = FontStyle.Bold;
|
||||
titleTxt.alignment = TextAnchor.MiddleCenter;
|
||||
titleTxt.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
titleTxt.text = "УРОВЕНЬ 1 ПРОЙДЕН!";
|
||||
|
||||
GameObject subObj = new GameObject("Subtitle");
|
||||
subObj.transform.SetParent(card.transform, false);
|
||||
RectTransform subRt = subObj.AddComponent<RectTransform>();
|
||||
subRt.anchorMin = new Vector2(0f, 1f);
|
||||
subRt.anchorMax = new Vector2(1f, 1f);
|
||||
subRt.pivot = new Vector2(0.5f, 1f);
|
||||
subRt.anchoredPosition = new Vector2(0f, -85f);
|
||||
subRt.sizeDelta = new Vector2(600f, 30f);
|
||||
|
||||
Text subTxt = subObj.AddComponent<Text>();
|
||||
subTxt.font = defaultUiFont;
|
||||
subTxt.fontSize = 16;
|
||||
subTxt.fontStyle = FontStyle.Bold;
|
||||
subTxt.alignment = TextAnchor.MiddleCenter;
|
||||
subTxt.color = new Color(0.2f, 1.0f, 0.4f, 1.0f);
|
||||
subTxt.text = "ЛИФТ УСПЕШНО АКТИВИРОВАН // СПУСК НА УРОВЕНЬ 2";
|
||||
|
||||
GameObject descObj = new GameObject("Description");
|
||||
descObj.transform.SetParent(card.transform, false);
|
||||
RectTransform descRt = descObj.AddComponent<RectTransform>();
|
||||
descRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
descRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
descRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
descRt.anchoredPosition = new Vector2(0f, 0f);
|
||||
descRt.sizeDelta = new Vector2(560f, 110f);
|
||||
|
||||
Text descTxt = descObj.AddComponent<Text>();
|
||||
descTxt.font = defaultUiFont;
|
||||
descTxt.fontSize = 16;
|
||||
descTxt.lineSpacing = 1.3f;
|
||||
descTxt.alignment = TextAnchor.MiddleCenter;
|
||||
descTxt.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
descTxt.text = "Вы успешно собрали все 4 цифры защитного кода с записок персонала и запустили гидравлический лифт.\n\nВторой (более сложный) уровень локации находится в разработке!";
|
||||
|
||||
GameObject btn1 = new GameObject("NextLevelButton");
|
||||
btn1.transform.SetParent(card.transform, false);
|
||||
RectTransform btn1Rt = btn1.AddComponent<RectTransform>();
|
||||
btn1Rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
btn1Rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
btn1Rt.pivot = new Vector2(0.5f, 0f);
|
||||
btn1Rt.anchoredPosition = new Vector2(0f, 95f);
|
||||
btn1Rt.sizeDelta = new Vector2(420f, 50f);
|
||||
|
||||
Image btn1Img = btn1.AddComponent<Image>();
|
||||
btn1Img.color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
|
||||
Button nextBtn = btn1.AddComponent<Button>();
|
||||
|
||||
GameObject b1Txt = new GameObject("Text");
|
||||
b1Txt.transform.SetParent(btn1.transform, false);
|
||||
RectTransform b1TxtRt = b1Txt.AddComponent<RectTransform>();
|
||||
b1TxtRt.anchorMin = Vector2.zero;
|
||||
b1TxtRt.anchorMax = Vector2.one;
|
||||
b1TxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text t1 = b1Txt.AddComponent<Text>();
|
||||
t1.font = defaultUiFont;
|
||||
t1.fontSize = 16;
|
||||
t1.fontStyle = FontStyle.Bold;
|
||||
t1.alignment = TextAnchor.MiddleCenter;
|
||||
t1.color = new Color(0.05f, 0.05f, 0.05f, 1.0f);
|
||||
t1.text = "СЫГРАТЬ СНОВА (НОВЫЙ СЛУЧАЙНЫЙ КОД)";
|
||||
|
||||
GameObject btn2 = new GameObject("MainMenuButton");
|
||||
btn2.transform.SetParent(card.transform, false);
|
||||
RectTransform btn2Rt = btn2.AddComponent<RectTransform>();
|
||||
btn2Rt.anchorMin = new Vector2(0.5f, 0f);
|
||||
btn2Rt.anchorMax = new Vector2(0.5f, 0f);
|
||||
btn2Rt.pivot = new Vector2(0.5f, 0f);
|
||||
btn2Rt.anchoredPosition = new Vector2(0f, 35f);
|
||||
btn2Rt.sizeDelta = new Vector2(420f, 44f);
|
||||
|
||||
Image btn2Img = btn2.AddComponent<Image>();
|
||||
btn2Img.color = new Color(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
|
||||
Outline b2Outline = btn2.AddComponent<Outline>();
|
||||
b2Outline.effectColor = new Color(0.5f, 0.5f, 0.5f, 0.6f);
|
||||
b2Outline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
Button menuBtn = btn2.AddComponent<Button>();
|
||||
|
||||
GameObject b2Txt = new GameObject("Text");
|
||||
b2Txt.transform.SetParent(btn2.transform, false);
|
||||
RectTransform b2TxtRt = b2Txt.AddComponent<RectTransform>();
|
||||
b2TxtRt.anchorMin = Vector2.zero;
|
||||
b2TxtRt.anchorMax = Vector2.one;
|
||||
b2TxtRt.sizeDelta = Vector2.zero;
|
||||
|
||||
Text t2 = b2Txt.AddComponent<Text>();
|
||||
t2.font = defaultUiFont;
|
||||
t2.fontSize = 15;
|
||||
t2.fontStyle = FontStyle.Bold;
|
||||
t2.alignment = TextAnchor.MiddleCenter;
|
||||
t2.color = new Color(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
t2.text = "В ГЛАВНОЕ МЕНЮ";
|
||||
|
||||
var successComp = rootPanel.AddComponent<LevelSuccessUI>();
|
||||
SetField(successComp, "successPanelRoot", rootPanel);
|
||||
SetField(successComp, "nextLevelButton", nextBtn);
|
||||
SetField(successComp, "mainMenuButton", menuBtn);
|
||||
|
||||
rootPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private static void SetField(object target, string fieldName, object value)
|
||||
{
|
||||
if (target == null) return;
|
||||
var field = target.GetType().GetField(fieldName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(target, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b954ae689718b0440a44d7a680740cba
|
||||
@@ -16,6 +16,8 @@ public static class PauseMenuBuilder
|
||||
public static string Build()
|
||||
{
|
||||
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
if (standardFont == null)
|
||||
standardFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||
|
||||
uiResources = new DefaultControls.Resources
|
||||
{
|
||||
@@ -30,7 +32,7 @@ public static class PauseMenuBuilder
|
||||
// Открываем сцену геймплея
|
||||
Scene gameplayScene = EditorSceneManager.OpenScene("Assets/Scenes/SampleScene.unity", OpenSceneMode.Single);
|
||||
|
||||
// Проверяем, есть ли уже EventSystem
|
||||
// Проверяем EventSystem
|
||||
if (Object.FindAnyObjectByType<EventSystem>() == null)
|
||||
{
|
||||
GameObject esGo = new GameObject("EventSystem");
|
||||
@@ -38,26 +40,15 @@ public static class PauseMenuBuilder
|
||||
esGo.AddComponent<InputSystemUIInputModule>();
|
||||
}
|
||||
|
||||
// Удаляем старый PauseMenu, если был (но сохраняем если есть продвинутый PauseRootPanel)
|
||||
// Пересоздаем PauseCanvas
|
||||
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 паузы
|
||||
GameObject canvasGo = new GameObject("PauseCanvas");
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
canvas.sortingOrder = 100; // Поверх всего
|
||||
canvas.sortingOrder = 100; // Поверх игрового мира
|
||||
|
||||
CanvasScaler scaler = canvasGo.AddComponent<CanvasScaler>();
|
||||
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
||||
@@ -69,32 +60,40 @@ public static class PauseMenuBuilder
|
||||
|
||||
PauseMenu pauseMenu = canvasGo.AddComponent<PauseMenu>();
|
||||
|
||||
// 1. Панель паузы (PauseMenuPanel)
|
||||
// Цвета стилистики Главного Меню (Synthesia Minimalist Black & Yellow)
|
||||
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);
|
||||
|
||||
// ==========================================
|
||||
// 1. КАРТОЧКА МЕНЮ ПАУЗЫ (PauseMenuPanel)
|
||||
// ==========================================
|
||||
GameObject pausePanel = CreateImage("PauseMenuPanel", canvasGo.transform,
|
||||
new Color(0.02f, 0.035f, 0.055f, 0.88f),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.88f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject card = CreateImage("Pause_Card", pausePanel.transform,
|
||||
new Color(0.06f, 0.09f, 0.14f, 0.98f),
|
||||
GameObject pauseCard = CreateImage("Pause_Card", pausePanel.transform,
|
||||
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(460f, 520f), Vector2.zero);
|
||||
new Vector2(480f, 560f), Vector2.zero);
|
||||
|
||||
Outline outline = card.AddComponent<Outline>();
|
||||
outline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.45f);
|
||||
outline.effectDistance = new Vector2(2f, -2f);
|
||||
Outline cardOutline = pauseCard.AddComponent<Outline>();
|
||||
cardOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
||||
cardOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
CreateText("Pause_Title", card.transform,
|
||||
CreateText("Pause_Title", pauseCard.transform,
|
||||
"ПАУЗА",
|
||||
34, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.92f, 0.97f, 1f, 1f),
|
||||
new Vector2(0.05f, 0.84f), new Vector2(0.95f, 0.96f), Vector2.zero, Vector2.zero);
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0.05f, 0.86f), new Vector2(0.95f, 0.97f), Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Pause_Divider", card.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.40f),
|
||||
new Vector2(0.10f, 0.82f), new Vector2(0.90f, 0.825f), Vector2.zero, Vector2.zero);
|
||||
CreateImage("Pause_Divider", pauseCard.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
||||
new Vector2(0.08f, 0.84f), new Vector2(0.92f, 0.845f), Vector2.zero, Vector2.zero);
|
||||
|
||||
GameObject btnContainer = CreateEmptyRect("Buttons_Container", card.transform,
|
||||
new Vector2(0.08f, 0.06f), new Vector2(0.92f, 0.78f), Vector2.zero, Vector2.zero);
|
||||
GameObject btnContainer = CreateEmptyRect("Buttons_Container", pauseCard.transform,
|
||||
new Vector2(0.08f, 0.05f), new Vector2(0.92f, 0.81f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup vLayout = btnContainer.AddComponent<VerticalLayoutGroup>();
|
||||
vLayout.spacing = 16f;
|
||||
@@ -104,139 +103,151 @@ public static class PauseMenuBuilder
|
||||
vLayout.childForceExpandWidth = true;
|
||||
vLayout.childForceExpandHeight = false;
|
||||
|
||||
// Кнопки меню паузы
|
||||
Button resumeBtn = CreateStyledButton("Btn_Resume", btnContainer.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),
|
||||
60f, 22);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button settingsBtn = CreateStyledButton("Btn_Settings", btnContainer.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),
|
||||
56f, 20);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button restartBtn = CreateStyledButton("Btn_Restart", btnContainer.transform,
|
||||
"↺ ЗАНОВО",
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button menuBtn = CreateStyledButton("Btn_MainMenu", btnContainer.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),
|
||||
56f, 20);
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText, 62f, 20);
|
||||
|
||||
Button quitBtn = CreateStyledButton("Btn_Quit", btnContainer.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),
|
||||
56f, 20);
|
||||
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, 62f, 20);
|
||||
|
||||
// 2. Панель настроек (SettingsPanel)
|
||||
// ==========================================
|
||||
// 2. ПАНЕЛЬ НАСТРОЕК (SettingsPanel) - ТОЧНО КАК В ГЛАВНОМ МЕНЮ
|
||||
// ==========================================
|
||||
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.80f),
|
||||
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(880f, 680f), Vector2.zero);
|
||||
new Vector2(920f, 740f), Vector2.zero);
|
||||
|
||||
Outline setOutline = settingsCard.AddComponent<Outline>();
|
||||
setOutline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.50f);
|
||||
setOutline.effectDistance = new Vector2(2f, -2f);
|
||||
Outline panelOutline = settingsCard.AddComponent<Outline>();
|
||||
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);
|
||||
|
||||
GameObject settingsList = CreateEmptyRect("Settings_List", settingsCard.transform,
|
||||
new Vector2(0.06f, 0.14f), new Vector2(0.94f, 0.87f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup sLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
sLayout.spacing = 16f;
|
||||
sLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
sLayout.childControlWidth = true;
|
||||
sLayout.childControlHeight = false;
|
||||
sLayout.childForceExpandWidth = true;
|
||||
sLayout.childForceExpandHeight = false;
|
||||
VerticalLayoutGroup settingsLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
settingsLayout.spacing = 15f;
|
||||
settingsLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
settingsLayout.childControlWidth = true;
|
||||
settingsLayout.childControlHeight = false;
|
||||
settingsLayout.childForceExpandWidth = true;
|
||||
settingsLayout.childForceExpandHeight = false;
|
||||
|
||||
// Разделы
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— АУДИО —");
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Общая громкость", 0f, 1f, 1f, "%");
|
||||
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук");
|
||||
// --- Раздел: Звук ---
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— ЗВУК И ЭХОЛОКАЦИЯ —");
|
||||
|
||||
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, "— ГРАФИКА —");
|
||||
|
||||
Dropdown qualityDropdown = CreateDropdownRow("Row_Quality", settingsList.transform, "Качество графики");
|
||||
Toggle fullscreenToggle = CreateToggleRow("Row_Fullscreen", settingsList.transform, "Полноэкранный режим");
|
||||
Dropdown resolutionDropdown = CreateDropdownRow("Row_Resolution", settingsList.transform, "Разрешение экрана");
|
||||
|
||||
// --- Раздел: Управление ---
|
||||
CreateCategoryHeader("HEADER_CONTROLS", settingsList.transform, "— УПРАВЛЕНИЕ —");
|
||||
var sensRow = CreateSliderRow("Row_Sensitivity", settingsList.transform, "Чувствительность мыши", 0.2f, 3.0f, 1.0f, "x");
|
||||
|
||||
GameObject botRow = CreateEmptyRect("Settings_BottomButtons", settingsCard.transform,
|
||||
var sensRow = CreateSliderRow("Row_Sensitivity", settingsList.transform, "Чувствительность мыши", 0.2f, 3.0f, 1.0f, "x");
|
||||
Slider sensSlider = sensRow.slider;
|
||||
Text sensText = sensRow.valueText;
|
||||
|
||||
// Нижняя строка кнопок в панели настроек
|
||||
GameObject bottomButtonsRow = CreateEmptyRect("Settings_BottomButtons", settingsCard.transform,
|
||||
new Vector2(0.06f, 0.03f), new Vector2(0.94f, 0.12f), Vector2.zero, Vector2.zero);
|
||||
|
||||
HorizontalLayoutGroup bLayout = botRow.AddComponent<HorizontalLayoutGroup>();
|
||||
bLayout.spacing = 30f;
|
||||
bLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
bLayout.childControlWidth = true;
|
||||
bLayout.childControlHeight = true;
|
||||
HorizontalLayoutGroup bottomLayout = bottomButtonsRow.AddComponent<HorizontalLayoutGroup>();
|
||||
bottomLayout.spacing = 30f;
|
||||
bottomLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
bottomLayout.childControlWidth = true;
|
||||
bottomLayout.childControlHeight = true;
|
||||
bottomLayout.childForceExpandWidth = true;
|
||||
bottomLayout.childForceExpandHeight = true;
|
||||
|
||||
Button backBtn = CreateStyledButton("Button_Back", botRow.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),
|
||||
48f, 18);
|
||||
Button resetBtn = CreateStyledButton("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,
|
||||
"Применить и выйти",
|
||||
yellowBtnNormal, yellowBtnHover, yellowBtnPress, blackBtnText,
|
||||
50f, 18);
|
||||
|
||||
// ==========================================
|
||||
// 3. ПРИВЯЗКА К СИСТЕМЕ PAUSEMENU
|
||||
// ==========================================
|
||||
pauseMenu.pauseMenuPanel = pausePanel;
|
||||
pauseMenu.settingsPanel = settingsPanel;
|
||||
pauseMenu.resumeButton = resumeBtn;
|
||||
pauseMenu.settingsButton = settingsBtn;
|
||||
pauseMenu.restartButton = restartBtn;
|
||||
pauseMenu.mainMenuButton = menuBtn;
|
||||
pauseMenu.quitButton = quitBtn;
|
||||
pauseMenu.backFromSettingsButton = backBtn;
|
||||
pauseMenu.resetDefaultsButton = resetBtn;
|
||||
|
||||
pauseMenu.volumeSlider = volumeRow.slider;
|
||||
pauseMenu.volumeValueText = volumeRow.valueText;
|
||||
pauseMenu.volumeSlider = volSlider;
|
||||
pauseMenu.volumeValueText = volText;
|
||||
pauseMenu.muteToggle = muteToggle;
|
||||
|
||||
pauseMenu.qualityDropdown = qualityDropdown;
|
||||
pauseMenu.fullscreenToggle = fullscreenToggle;
|
||||
|
||||
pauseMenu.sensitivitySlider = sensRow.slider;
|
||||
pauseMenu.sensitivityValueText = sensRow.valueText;
|
||||
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(resumeBtn.onClick, pauseMenu.ResumeGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(settingsBtn.onClick, pauseMenu.OpenSettings);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(menuBtn.onClick, pauseMenu.ReturnToMainMenu);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(quitBtn.onClick, pauseMenu.QuitGame);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, pauseMenu.CloseSettings);
|
||||
pauseMenu.resolutionDropdown = resolutionDropdown;
|
||||
pauseMenu.sensitivitySlider = sensSlider;
|
||||
pauseMenu.sensitivityValueText = sensText;
|
||||
|
||||
pausePanel.SetActive(false);
|
||||
settingsPanel.SetActive(false);
|
||||
|
||||
// Строим DeathScreenPanel в PauseCanvas
|
||||
// Также гарантируем экран смерти
|
||||
DeathScreenBuilder.Build();
|
||||
|
||||
// Сохраняем сцену геймплея
|
||||
EditorSceneManager.MarkSceneDirty(gameplayScene);
|
||||
EditorSceneManager.SaveScene(gameplayScene);
|
||||
Debug.Log("[PauseMenuBuilder] PauseMenu успешно добавлен в SampleScene.unity");
|
||||
Debug.Log("[PauseMenuBuilder] PauseCanvas в стиле MainMenu успешно создан и сохранен в SampleScene.unity");
|
||||
|
||||
// Открываем обратно сцену MainMenu
|
||||
EditorSceneManager.OpenScene("Assets/Scenes/MainMenu.unity", OpenSceneMode.Single);
|
||||
|
||||
return "SUCCESS: PauseMenu added to SampleScene and MainMenu restored!";
|
||||
return "SUCCESS: PauseMenu rebuilt with separate Settings panel matching MainMenu style!";
|
||||
}
|
||||
|
||||
#region Хелперы UI
|
||||
@@ -258,8 +269,6 @@ public static class PauseMenuBuilder
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -273,7 +282,7 @@ public static class PauseMenuBuilder
|
||||
t.fontStyle = style;
|
||||
t.alignment = alignment;
|
||||
t.color = color;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
t.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
return go;
|
||||
}
|
||||
@@ -284,6 +293,12 @@ public static class PauseMenuBuilder
|
||||
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;
|
||||
@@ -292,6 +307,14 @@ public static class PauseMenuBuilder
|
||||
img.color = normalColor;
|
||||
img.type = Image.Type.Sliced;
|
||||
|
||||
Outline btnOutline = btnObj.AddComponent<Outline>();
|
||||
btnOutline.effectColor = new Color(1.00f, 0.95f, 0.60f, 0.65f);
|
||||
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(2f, -2f);
|
||||
|
||||
Button btn = btnObj.GetComponent<Button>();
|
||||
ColorBlock colors = btn.colors;
|
||||
colors.normalColor = normalColor;
|
||||
@@ -311,6 +334,8 @@ public static class PauseMenuBuilder
|
||||
text.fontStyle = FontStyle.Bold;
|
||||
text.color = textColor;
|
||||
text.alignment = TextAnchor.MiddleCenter;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
text.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
}
|
||||
|
||||
return btn;
|
||||
@@ -318,10 +343,10 @@ public static class PauseMenuBuilder
|
||||
|
||||
private static void CreateCategoryHeader(string name, Transform parent, string text)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 30f), Vector2.zero);
|
||||
GameObject go = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 32f), Vector2.zero);
|
||||
LayoutElement layout = go.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 30f;
|
||||
layout.preferredHeight = 30f;
|
||||
layout.minHeight = 32f;
|
||||
layout.preferredHeight = 32f;
|
||||
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
@@ -329,147 +354,96 @@ public static class PauseMenuBuilder
|
||||
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, 40f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 40f;
|
||||
layout.preferredHeight = 40f;
|
||||
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;
|
||||
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(260f, 40f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
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 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(80f, 40f), Vector2.zero);
|
||||
LayoutElement valLayout = valGo.AddComponent<LayoutElement>();
|
||||
valLayout.minWidth = 80f;
|
||||
valLayout.preferredWidth = 80f;
|
||||
Text valText = valGo.AddComponent<Text>();
|
||||
valText.font = standardFont;
|
||||
valText.text = unit == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unit}";
|
||||
valText.fontSize = 17;
|
||||
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)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 38f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 40f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 38f;
|
||||
layout.preferredHeight = 38f;
|
||||
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;
|
||||
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(260f, 38f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
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 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);
|
||||
|
||||
return toggleObj.GetComponent<Toggle>();
|
||||
}
|
||||
|
||||
private static Dropdown CreateDropdownRow(string name, Transform parent, string label)
|
||||
{
|
||||
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(260f, 42f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 260f;
|
||||
lblLayout.preferredWidth = 260f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 17;
|
||||
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;
|
||||
|
||||
GameObject dropdownObj = DefaultControls.CreateDropdown(uiResources);
|
||||
dropdownObj.name = "Dropdown";
|
||||
dropdownObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement ddLayout = dropdownObj.AddComponent<LayoutElement>();
|
||||
ddLayout.minWidth = 380f;
|
||||
ddLayout.preferredWidth = 380f;
|
||||
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,297 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Терминал лифта: ввод 4-значного кода доступа для перехода на 2-й уровень.
|
||||
/// </summary>
|
||||
public class ElevatorKeypadUI : MonoBehaviour
|
||||
{
|
||||
private static ElevatorKeypadUI _instance;
|
||||
public static ElevatorKeypadUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<ElevatorKeypadUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject keypadPanelRoot;
|
||||
|
||||
[Header("Слоты для отображения цифр")]
|
||||
[SerializeField] private Text[] digitSlots = new Text[4];
|
||||
[SerializeField] private Image[] digitSlotBorders = new Image[4];
|
||||
|
||||
[Header("Статусная строка")]
|
||||
[SerializeField] private Text statusText;
|
||||
|
||||
[Header("Кнопки клавиатуры")]
|
||||
[SerializeField] private Button[] numberButtons; // 0..9
|
||||
[SerializeField] private Button clearButton;
|
||||
[SerializeField] private Button enterButton;
|
||||
[SerializeField] private Button exitButton;
|
||||
|
||||
[Header("Цвета статуса")]
|
||||
public Color normalStatusColor = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
public Color errorStatusColor = new Color(1.0f, 0.25f, 0.25f, 1.0f);
|
||||
public Color successStatusColor = new Color(0.2f, 1.0f, 0.4f, 1.0f);
|
||||
|
||||
private string enteredCode = "";
|
||||
private bool isOpen = false;
|
||||
private bool isLockedSuccess = false;
|
||||
|
||||
public bool IsOpen => isOpen;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (keypadPanelRoot == null)
|
||||
keypadPanelRoot = gameObject;
|
||||
|
||||
SetupButtons();
|
||||
}
|
||||
|
||||
private void SetupButtons()
|
||||
{
|
||||
if (numberButtons != null)
|
||||
{
|
||||
for (int i = 0; i < numberButtons.Length; i++)
|
||||
{
|
||||
int num = i;
|
||||
if (numberButtons[i] != null)
|
||||
{
|
||||
numberButtons[i].onClick.RemoveAllListeners();
|
||||
numberButtons[i].onClick.AddListener(() => OnNumberPressed(num));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clearButton != null)
|
||||
{
|
||||
clearButton.onClick.RemoveAllListeners();
|
||||
clearButton.onClick.AddListener(OnClearPressed);
|
||||
}
|
||||
|
||||
if (enterButton != null)
|
||||
{
|
||||
enterButton.onClick.RemoveAllListeners();
|
||||
enterButton.onClick.AddListener(OnEnterPressed);
|
||||
}
|
||||
|
||||
if (exitButton != null)
|
||||
{
|
||||
exitButton.onClick.RemoveAllListeners();
|
||||
exitButton.onClick.AddListener(CloseKeypad);
|
||||
}
|
||||
}
|
||||
|
||||
private int openFrame = -1;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
if (Time.frameCount == openFrame) return;
|
||||
|
||||
HandleKeyboardInput();
|
||||
}
|
||||
|
||||
private void HandleKeyboardInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame)
|
||||
{
|
||||
CloseKeypad();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isLockedSuccess)
|
||||
{
|
||||
if (keyboard.digit0Key.wasPressedThisFrame || keyboard.numpad0Key.wasPressedThisFrame) OnNumberPressed(0);
|
||||
else if (keyboard.digit1Key.wasPressedThisFrame || keyboard.numpad1Key.wasPressedThisFrame) OnNumberPressed(1);
|
||||
else if (keyboard.digit2Key.wasPressedThisFrame || keyboard.numpad2Key.wasPressedThisFrame) OnNumberPressed(2);
|
||||
else if (keyboard.digit3Key.wasPressedThisFrame || keyboard.numpad3Key.wasPressedThisFrame) OnNumberPressed(3);
|
||||
else if (keyboard.digit4Key.wasPressedThisFrame || keyboard.numpad4Key.wasPressedThisFrame) OnNumberPressed(4);
|
||||
else if (keyboard.digit5Key.wasPressedThisFrame || keyboard.numpad5Key.wasPressedThisFrame) OnNumberPressed(5);
|
||||
else if (keyboard.digit6Key.wasPressedThisFrame || keyboard.numpad6Key.wasPressedThisFrame) OnNumberPressed(6);
|
||||
else if (keyboard.digit7Key.wasPressedThisFrame || keyboard.numpad7Key.wasPressedThisFrame) OnNumberPressed(7);
|
||||
else if (keyboard.digit8Key.wasPressedThisFrame || keyboard.numpad8Key.wasPressedThisFrame) OnNumberPressed(8);
|
||||
else if (keyboard.digit9Key.wasPressedThisFrame || keyboard.numpad9Key.wasPressedThisFrame) OnNumberPressed(9);
|
||||
|
||||
if (keyboard.backspaceKey.wasPressedThisFrame || keyboard.deleteKey.wasPressedThisFrame || keyboard.cKey.wasPressedThisFrame)
|
||||
{
|
||||
OnBackspacePressed();
|
||||
}
|
||||
|
||||
if (keyboard.enterKey.wasPressedThisFrame || keyboard.numpadEnterKey.wasPressedThisFrame)
|
||||
{
|
||||
OnEnterPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
CloseKeypad();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void OpenKeypad()
|
||||
{
|
||||
openFrame = Time.frameCount;
|
||||
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (keypadPanelRoot != null && !keypadPanelRoot.activeSelf)
|
||||
keypadPanelRoot.SetActive(true);
|
||||
|
||||
isOpen = true;
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
enteredCode = "";
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadBeep();
|
||||
}
|
||||
|
||||
public void CloseKeypad()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
|
||||
isOpen = false;
|
||||
if (keypadPanelRoot != null)
|
||||
keypadPanelRoot.SetActive(false);
|
||||
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
}
|
||||
|
||||
public void OnNumberPressed(int number)
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length < 4)
|
||||
{
|
||||
enteredCode += number.ToString();
|
||||
GameAudioSynthesizer.PlayKeypadBeep();
|
||||
UpdateDisplay();
|
||||
|
||||
if (enteredCode.Length == 4)
|
||||
{
|
||||
SetStatus("НАЖМИТЕ [ВВОД / ENTER] ДЛЯ ПРОВЕРКИ", normalStatusColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBackspacePressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length > 0)
|
||||
{
|
||||
enteredCode = enteredCode.Substring(0, enteredCode.Length - 1);
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClearPressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
enteredCode = "";
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
UpdateDisplay();
|
||||
SetStatus("КОД СБРОШЕН. ВВЕДИТЕ ЗАНОВО", normalStatusColor);
|
||||
}
|
||||
|
||||
public void OnEnterPressed()
|
||||
{
|
||||
if (isLockedSuccess) return;
|
||||
|
||||
if (enteredCode.Length != 4)
|
||||
{
|
||||
SetStatus("ОШИБКА: ТРЕБУЕТСЯ 4 ЦИФРЫ!", errorStatusColor);
|
||||
GameAudioSynthesizer.PlayErrorCode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (LevelCodeManager.Instance != null && LevelCodeManager.Instance.ValidateCode(enteredCode))
|
||||
{
|
||||
isLockedSuccess = true;
|
||||
SetStatus("ДОСТУП РАЗРЕШЕН! ЗАПУСК ЛИФТА НА УРОВЕНЬ 2...", successStatusColor);
|
||||
GameAudioSynthesizer.PlaySuccessChime();
|
||||
StartCoroutine(RoutineSuccessTransition());
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus("ОТКАЗ В ДОСТУПЕ! НЕВЕРНЫЙ КОД", errorStatusColor);
|
||||
GameAudioSynthesizer.PlayErrorCode();
|
||||
StartCoroutine(RoutineWrongCodeShake());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator RoutineWrongCodeShake()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.8f);
|
||||
enteredCode = "";
|
||||
UpdateDisplay();
|
||||
SetStatus("ВВЕДИТЕ 4-ЗНАЧНЫЙ КОД ДОСТУПА", normalStatusColor);
|
||||
}
|
||||
|
||||
private IEnumerator RoutineSuccessTransition()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1.8f);
|
||||
CloseKeypad();
|
||||
|
||||
if (LevelSuccessUI.Instance != null)
|
||||
{
|
||||
LevelSuccessUI.Instance.ShowSuccessScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDisplay()
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (digitSlots != null && i < digitSlots.Length && digitSlots[i] != null)
|
||||
{
|
||||
if (i < enteredCode.Length)
|
||||
{
|
||||
digitSlots[i].text = enteredCode[i].ToString();
|
||||
digitSlots[i].color = new Color(1.0f, 0.85f, 0.1f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitSlots[i].text = "_";
|
||||
digitSlots[i].color = new Color(0.4f, 0.4f, 0.4f, 0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStatus(string text, Color color)
|
||||
{
|
||||
if (statusText != null)
|
||||
{
|
||||
statusText.text = text;
|
||||
statusText.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5ad50222d8ef14448d5a544b3d27998
|
||||
@@ -0,0 +1,163 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Терминал лифта в 3D мире.
|
||||
/// Игрок может подойти, увидеть подсказку и нажать [E] для открытия UI цифрового ввода кода.
|
||||
/// </summary>
|
||||
public class ElevatorTerminal : MonoBehaviour
|
||||
{
|
||||
[Header("Дистанция взаимодействия")]
|
||||
public float interactionDistance = 3.8f;
|
||||
|
||||
[Header("Индикаторы")]
|
||||
public Light statusLight;
|
||||
public MeshRenderer screenRenderer;
|
||||
|
||||
private static Transform cachedPlayerTransform;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
LocatePlayer();
|
||||
UpdateLightColor(false);
|
||||
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnElevatorUnlocked += HandleUnlocked;
|
||||
}
|
||||
|
||||
var col = GetComponent<Collider>();
|
||||
if (col == null)
|
||||
{
|
||||
var sc = gameObject.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = interactionDistance;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.OnElevatorUnlocked -= HandleUnlocked;
|
||||
}
|
||||
}
|
||||
|
||||
private Transform LocatePlayer()
|
||||
{
|
||||
if (cachedPlayerTransform != null) return cachedPlayerTransform;
|
||||
|
||||
var pm = Object.FindAnyObjectByType<PlayerMovement>();
|
||||
if (pm != null) { cachedPlayerTransform = pm.transform; return cachedPlayerTransform; }
|
||||
|
||||
var ph = Object.FindAnyObjectByType<PlayerHealth>();
|
||||
if (ph != null) { cachedPlayerTransform = ph.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pTag = GameObject.FindWithTag("Player");
|
||||
if (pTag != null) { cachedPlayerTransform = pTag.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pName = GameObject.Find("Player");
|
||||
if (pName != null) { cachedPlayerTransform = pName.transform; return cachedPlayerTransform; }
|
||||
|
||||
if (Camera.main != null) { return Camera.main.transform; }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void HandleUnlocked()
|
||||
{
|
||||
UpdateLightColor(true);
|
||||
}
|
||||
|
||||
private void UpdateLightColor(bool isUnlocked)
|
||||
{
|
||||
if (statusLight != null)
|
||||
{
|
||||
statusLight.color = isUnlocked ? new Color(0.2f, 1f, 0.4f) : new Color(1f, 0.85f, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
Transform player = LocatePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
float dist3D = Vector3.Distance(transform.position, player.position);
|
||||
float distXZ = Vector2.Distance(new Vector2(transform.position.x, transform.position.z),
|
||||
new Vector2(player.position.x, player.position.z));
|
||||
|
||||
bool inRange = dist3D <= interactionDistance || distXZ <= (interactionDistance * 0.9f);
|
||||
|
||||
if (inRange)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
if (other.CompareTag("Player") || other.GetComponentInParent<PlayerMovement>() != null)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckInteractInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.fKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.F) || Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
bool isUnlocked = LevelCodeManager.Instance != null && LevelCodeManager.Instance.IsElevatorUnlocked;
|
||||
|
||||
if (isUnlocked)
|
||||
{
|
||||
if (LevelSuccessUI.Instance != null)
|
||||
{
|
||||
LevelSuccessUI.Instance.ShowSuccessScreen();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ElevatorKeypadUI.Instance != null)
|
||||
{
|
||||
ElevatorKeypadUI.Instance.OpenKeypad();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[ElevatorTerminal] ElevatorKeypadUI.Instance is NULL!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5c633e6b03188a41aa36f163c1061ee
|
||||
@@ -0,0 +1,150 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Процедурный синтезатор звуковых эффектов для интерфейса терминала, кнопок и записок.
|
||||
/// Создает чистые звуки прямо в оперативной памяти (AudioClip.Create) без внешних файлов.
|
||||
/// </summary>
|
||||
public static class GameAudioSynthesizer
|
||||
{
|
||||
private static AudioSource globalAudioSource;
|
||||
|
||||
private static AudioSource GetAudioSource()
|
||||
{
|
||||
if (globalAudioSource == null)
|
||||
{
|
||||
var go = new GameObject("ProceduralUIAudioSource");
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
Object.DontDestroyOnLoad(go);
|
||||
}
|
||||
globalAudioSource = go.AddComponent<AudioSource>();
|
||||
globalAudioSource.playOnAwake = false;
|
||||
globalAudioSource.spatialBlend = 0f; // 2D звук интерфейса
|
||||
globalAudioSource.ignoreListenerPause = true; // Работает даже при Time.timeScale = 0
|
||||
}
|
||||
return globalAudioSource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Короткий высокий бип нажатия кнопки терминала (1200 Hz)
|
||||
/// </summary>
|
||||
public static void PlayKeypadBeep()
|
||||
{
|
||||
AudioClip clip = CreateToneClip(1200f, 0.05f, 0.25f);
|
||||
PlayOneShot(clip, 0.35f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук сброса/стирания цифры (700 Hz)
|
||||
/// </summary>
|
||||
public static void PlayKeypadClear()
|
||||
{
|
||||
AudioClip clip = CreateToneClip(700f, 0.08f, 0.3f);
|
||||
PlayOneShot(clip, 0.3f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук ошибки ввода (низкий двойной зуммер 160Hz)
|
||||
/// </summary>
|
||||
public static void PlayErrorCode()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.25f);
|
||||
float[] data = new float[samples];
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float freq = 160f;
|
||||
float pulse = Mathf.Sin(2f * Mathf.PI * 18f * t) > 0f ? 1f : 0f;
|
||||
data[i] = Mathf.Sin(2f * Mathf.PI * freq * t) * pulse * (1f - (float)i / samples) * 0.4f;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("ErrorCodeTone", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.45f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Торжественный трезвук успеха (C-E-G мажорный перелив)
|
||||
/// </summary>
|
||||
public static void PlaySuccessChime()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.6f);
|
||||
float[] data = new float[samples];
|
||||
|
||||
float[] freqs = new float[] { 523.25f, 659.25f, 783.99f, 1046.50f };
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float sampleVal = 0f;
|
||||
|
||||
for (int f = 0; f < freqs.Length; f++)
|
||||
{
|
||||
float startTime = f * 0.1f;
|
||||
if (t >= startTime)
|
||||
{
|
||||
float noteTime = t - startTime;
|
||||
float env = Mathf.Exp(-noteTime * 4.5f);
|
||||
sampleVal += Mathf.Sin(2f * Mathf.PI * freqs[f] * noteTime) * env * 0.2f;
|
||||
}
|
||||
}
|
||||
data[i] = Mathf.Clamp(sampleVal, -0.9f, 0.9f);
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("SuccessChime", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.5f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Звук разворачивания/чтения секретной записки (шум бумаги + легкий звон)
|
||||
/// </summary>
|
||||
public static void PlayPaperRustle()
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * 0.18f);
|
||||
float[] data = new float[samples];
|
||||
|
||||
System.Random rnd = new System.Random(42);
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float env = 1f - (float)i / samples;
|
||||
float noise = ((float)rnd.NextDouble() * 2f - 1f) * 0.15f;
|
||||
float chime = Mathf.Sin(2f * Mathf.PI * 1400f * ((float)i / sampleRate)) * 0.12f;
|
||||
data[i] = (noise + chime) * env;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create("PaperRustle", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
PlayOneShot(clip, 0.4f);
|
||||
}
|
||||
|
||||
private static AudioClip CreateToneClip(float frequency, float duration, float volume)
|
||||
{
|
||||
int sampleRate = 44100;
|
||||
int samples = (int)(sampleRate * duration);
|
||||
float[] data = new float[samples];
|
||||
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
float t = (float)i / sampleRate;
|
||||
float env = 1f - ((float)i / samples);
|
||||
data[i] = Mathf.Sin(2f * Mathf.PI * frequency * t) * env * volume;
|
||||
}
|
||||
|
||||
AudioClip clip = AudioClip.Create($"Tone_{frequency}", samples, 1, sampleRate, false);
|
||||
clip.SetData(data, 0);
|
||||
return clip;
|
||||
}
|
||||
|
||||
private static void PlayOneShot(AudioClip clip, float volumeScale)
|
||||
{
|
||||
if (clip == null) return;
|
||||
var src = GetAudioSource();
|
||||
if (src != null)
|
||||
{
|
||||
src.PlayOneShot(clip, volumeScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe4a4f53134c5634da9ed6ae233002a9
|
||||
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Плашка подсказки взаимодействия (например "[E] ПРОЧЕСТЬ ЗАПИСКУ"),
|
||||
/// отображаемая по центру экрана под прицелом, когда игрок подходит к интерактивному объекту.
|
||||
/// </summary>
|
||||
public class InteractionPromptUI : MonoBehaviour
|
||||
{
|
||||
private static InteractionPromptUI _instance;
|
||||
public static InteractionPromptUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<InteractionPromptUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private GameObject promptRoot;
|
||||
[SerializeField] private Text promptText;
|
||||
|
||||
private float hideTimer = 0f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (promptRoot == null)
|
||||
{
|
||||
promptRoot = transform.childCount > 0 ? transform.GetChild(0).gameObject : gameObject;
|
||||
}
|
||||
HidePromptImmediate();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (hideTimer > 0f)
|
||||
{
|
||||
hideTimer -= Time.unscaledDeltaTime;
|
||||
if (hideTimer <= 0f)
|
||||
{
|
||||
HidePromptImmediate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowPrompt(string message, float duration = 0.25f)
|
||||
{
|
||||
if (promptRoot != null)
|
||||
{
|
||||
if (!promptRoot.activeSelf) promptRoot.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (promptText != null)
|
||||
{
|
||||
promptText.text = message;
|
||||
}
|
||||
hideTimer = duration;
|
||||
}
|
||||
|
||||
public void HidePromptImmediate()
|
||||
{
|
||||
if (promptRoot != null && promptRoot != gameObject)
|
||||
{
|
||||
promptRoot.SetActive(false);
|
||||
}
|
||||
hideTimer = 0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f61a9d28815bc26489b75c6e880ac4d2
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Менеджер сюжета и 4-значного случайного кода доступа к лифту на 2-й уровень.
|
||||
/// Генерирует уникальный случайный код при каждом старте игры и отслеживает найденные записки.
|
||||
/// </summary>
|
||||
public class LevelCodeManager : MonoBehaviour
|
||||
{
|
||||
private static LevelCodeManager _instance;
|
||||
public static LevelCodeManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = UnityEngine.Object.FindAnyObjectByType<LevelCodeManager>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Сгенерированный код (4 цифры)")]
|
||||
[SerializeField] private int[] secretDigits = new int[4];
|
||||
[SerializeField] private bool[] discoveredDigits = new bool[4];
|
||||
|
||||
public event Action<int, int> OnDigitDiscovered; // (позиция 0..3, значение 0..9)
|
||||
public event Action OnElevatorUnlocked;
|
||||
|
||||
public bool IsElevatorUnlocked { get; private set; } = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
GenerateSecretCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Генерирует новый 4-значный случайный код (например, 7-2-4-9)
|
||||
/// </summary>
|
||||
public void GenerateSecretCode()
|
||||
{
|
||||
IsElevatorUnlocked = false;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
secretDigits[i] = UnityEngine.Random.Range(0, 10);
|
||||
discoveredDigits[i] = false;
|
||||
}
|
||||
|
||||
Debug.Log($"<color=yellow>[LevelCodeManager] Сгенерирован код лифта для Уровня 1: " +
|
||||
$"{secretDigits[0]} - {secretDigits[1]} - {secretDigits[2]} - {secretDigits[3]}</color>");
|
||||
}
|
||||
|
||||
public int GetDigit(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
return secretDigits[position];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsDigitDiscovered(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
return discoveredDigits[position];
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DiscoverDigit(int position)
|
||||
{
|
||||
if (position >= 0 && position < 4)
|
||||
{
|
||||
bool wasDiscovered = discoveredDigits[position];
|
||||
discoveredDigits[position] = true;
|
||||
|
||||
if (!wasDiscovered)
|
||||
{
|
||||
OnDigitDiscovered?.Invoke(position, secretDigits[position]);
|
||||
Debug.Log($"<color=yellow>[LevelCodeManager] Открыта цифра #{position + 1}: {secretDigits[position]}</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateCode(string enteredCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(enteredCode) || enteredCode.Length != 4)
|
||||
return false;
|
||||
|
||||
string correctCode = $"{secretDigits[0]}{secretDigits[1]}{secretDigits[2]}{secretDigits[3]}";
|
||||
bool isCorrect = enteredCode.Trim().Equals(correctCode, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (isCorrect)
|
||||
{
|
||||
IsElevatorUnlocked = true;
|
||||
OnElevatorUnlocked?.Invoke();
|
||||
Debug.Log("<color=green>[LevelCodeManager] Код лифта введен ВЕРНО! Доступ к Уровню 2 открыт.</color>");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"<color=red>[LevelCodeManager] Неверный код: '{enteredCode}' (ожидался '{correctCode}')</color>");
|
||||
}
|
||||
|
||||
return isCorrect;
|
||||
}
|
||||
|
||||
public string GetFullCodeString()
|
||||
{
|
||||
return $"{secretDigits[0]}{secretDigits[1]}{secretDigits[2]}{secretDigits[3]}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c568b40c5574cc4a8974aa8313013ce
|
||||
@@ -0,0 +1,75 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Экран завершения первого уровня при успешном вводе кода лифта.
|
||||
/// </summary>
|
||||
public class LevelSuccessUI : MonoBehaviour
|
||||
{
|
||||
private static LevelSuccessUI _instance;
|
||||
public static LevelSuccessUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<LevelSuccessUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject successPanelRoot;
|
||||
|
||||
public bool IsOpen => successPanelRoot != null && successPanelRoot.activeInHierarchy;
|
||||
|
||||
[Header("Кнопки")]
|
||||
[SerializeField] private Button nextLevelButton;
|
||||
[SerializeField] private Button mainMenuButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (successPanelRoot == null)
|
||||
successPanelRoot = gameObject;
|
||||
|
||||
if (nextLevelButton != null)
|
||||
{
|
||||
nextLevelButton.onClick.RemoveAllListeners();
|
||||
nextLevelButton.onClick.AddListener(OnNextLevelClicked);
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(OnMainMenuClicked);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowSuccessScreen()
|
||||
{
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (successPanelRoot != null)
|
||||
successPanelRoot.SetActive(true);
|
||||
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
GameAudioSynthesizer.PlaySuccessChime();
|
||||
}
|
||||
|
||||
private void OnNextLevelClicked()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
private void OnMainMenuClicked()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("MainMenu");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55bca2c832af0a746b24103bb27a44cd
|
||||
@@ -0,0 +1,149 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Интерактивная сюжетная записка в 3D мире.
|
||||
/// Игрок может подойти, увидеть подсказку и нажать [E] для открытия полноэкранного документа.
|
||||
/// </summary>
|
||||
public class NotePickup : MonoBehaviour
|
||||
{
|
||||
[Header("Настройки кода лифта")]
|
||||
[Tooltip("Порядковый номер в коде: 0 = 1-я цифра, 1 = 2-я цифра, 2 = 3-я цифра, 3 = 4-я цифра")]
|
||||
public int digitPosition = 0;
|
||||
|
||||
[Header("Сюжетное описание")]
|
||||
public string noteTitle = "ЗАПИСКА ИССЛЕДОВАТЕЛЯ";
|
||||
public string sectorName = "СЕКТОР АРХИВА";
|
||||
[TextArea(3, 8)]
|
||||
public string storyText = "Мы заблокировали лифт в нижний уровень, чтобы задержать биомассу. Если кто-то выжил, введите код в терминал...";
|
||||
|
||||
[Header("Дистанция взаимодействия")]
|
||||
public float interactionDistance = 3.6f;
|
||||
|
||||
[Header("Визуальное покачивание и свечение")]
|
||||
public bool animateHover = true;
|
||||
public float hoverSpeed = 2.0f;
|
||||
public float hoverHeight = 0.05f;
|
||||
|
||||
private Vector3 initialPos;
|
||||
private static Transform cachedPlayerTransform;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initialPos = transform.position;
|
||||
LocatePlayer();
|
||||
|
||||
var col = GetComponent<Collider>();
|
||||
if (col == null)
|
||||
{
|
||||
var sc = gameObject.AddComponent<SphereCollider>();
|
||||
sc.isTrigger = true;
|
||||
sc.radius = interactionDistance;
|
||||
}
|
||||
}
|
||||
|
||||
private Transform LocatePlayer()
|
||||
{
|
||||
if (cachedPlayerTransform != null) return cachedPlayerTransform;
|
||||
|
||||
var pm = Object.FindAnyObjectByType<PlayerMovement>();
|
||||
if (pm != null) { cachedPlayerTransform = pm.transform; return cachedPlayerTransform; }
|
||||
|
||||
var ph = Object.FindAnyObjectByType<PlayerHealth>();
|
||||
if (ph != null) { cachedPlayerTransform = ph.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pTag = GameObject.FindWithTag("Player");
|
||||
if (pTag != null) { cachedPlayerTransform = pTag.transform; return cachedPlayerTransform; }
|
||||
|
||||
var pName = GameObject.Find("Player");
|
||||
if (pName != null) { cachedPlayerTransform = pName.transform; return cachedPlayerTransform; }
|
||||
|
||||
if (Camera.main != null) { return Camera.main.transform; }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (animateHover)
|
||||
{
|
||||
float newY = initialPos.y + Mathf.Sin(Time.time * hoverSpeed) * hoverHeight;
|
||||
transform.position = new Vector3(initialPos.x, newY, initialPos.z);
|
||||
}
|
||||
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
Transform player = LocatePlayer();
|
||||
if (player == null) return;
|
||||
|
||||
float dist3D = Vector3.Distance(transform.position, player.position);
|
||||
float distXZ = Vector2.Distance(new Vector2(transform.position.x, transform.position.z),
|
||||
new Vector2(player.position.x, player.position.z));
|
||||
|
||||
bool inRange = dist3D <= interactionDistance || distXZ <= (interactionDistance * 0.9f);
|
||||
|
||||
if (inRange)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (Time.timeScale == 0f) return;
|
||||
|
||||
if (other.CompareTag("Player") || other.GetComponentInParent<PlayerMovement>() != null)
|
||||
{
|
||||
if (CheckInteractInput())
|
||||
{
|
||||
Interact();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckInteractInput()
|
||||
{
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.fKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.F) || Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Interact()
|
||||
{
|
||||
int digit = 0;
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
digit = LevelCodeManager.Instance.GetDigit(digitPosition);
|
||||
}
|
||||
|
||||
if (NoteViewerUI.Instance != null)
|
||||
{
|
||||
NoteViewerUI.Instance.OpenNote(digitPosition, digit, sectorName, noteTitle, storyText);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("[NotePickup] NoteViewerUI.Instance is NULL!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d945ca331500b1343943e3cb838ecfe7
|
||||
@@ -0,0 +1,145 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Полноэкранный просмотрщик найденных записок.
|
||||
/// Отрисовывает крупную цифру на бумажке, её позицию в терминале лифта (1-я, 2-я, 3-я или 4-я),
|
||||
/// гриф секретности и атмосферный сюжетный текст.
|
||||
/// </summary>
|
||||
public class NoteViewerUI : MonoBehaviour
|
||||
{
|
||||
private static NoteViewerUI _instance;
|
||||
public static NoteViewerUI Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = Object.FindAnyObjectByType<NoteViewerUI>(FindObjectsInactive.Include);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Корневая панель")]
|
||||
[SerializeField] private GameObject notePanelRoot;
|
||||
|
||||
[Header("Элементы документа")]
|
||||
[SerializeField] private Text documentHeader;
|
||||
[SerializeField] private Text sectorText;
|
||||
[SerializeField] private Text positionNoticeText;
|
||||
[SerializeField] private Text bigDigitText;
|
||||
[SerializeField] private Text flavorBodyText;
|
||||
[SerializeField] private Button closeButton;
|
||||
|
||||
private bool isOpen = false;
|
||||
public bool IsOpen => isOpen;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
if (notePanelRoot == null)
|
||||
notePanelRoot = gameObject;
|
||||
|
||||
if (closeButton != null)
|
||||
{
|
||||
closeButton.onClick.RemoveAllListeners();
|
||||
closeButton.onClick.AddListener(CloseNote);
|
||||
}
|
||||
}
|
||||
|
||||
private int openFrame = -1;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
if (Time.frameCount == openFrame) return;
|
||||
|
||||
bool closePressed = false;
|
||||
|
||||
var keyboard = Keyboard.current;
|
||||
if (keyboard != null)
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame ||
|
||||
keyboard.eKey.wasPressedThisFrame ||
|
||||
keyboard.spaceKey.wasPressedThisFrame ||
|
||||
keyboard.enterKey.wasPressedThisFrame)
|
||||
{
|
||||
closePressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
closePressed = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (closePressed)
|
||||
{
|
||||
CloseNote();
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenNote(int positionIndex, int digit, string sector, string noteTitle, string storyText)
|
||||
{
|
||||
openFrame = Time.frameCount;
|
||||
|
||||
if (!gameObject.activeSelf) gameObject.SetActive(true);
|
||||
if (notePanelRoot != null && !notePanelRoot.activeSelf)
|
||||
notePanelRoot.SetActive(true);
|
||||
|
||||
isOpen = true;
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
|
||||
if (documentHeader != null)
|
||||
documentHeader.text = "Секретный протокол";
|
||||
|
||||
if (sectorText != null)
|
||||
sectorText.text = $"Отсек: {sector.ToUpper()}";
|
||||
|
||||
string posStr = positionIndex switch
|
||||
{
|
||||
0 => "1-я цифра [ _ * * * ]",
|
||||
1 => "2-я цифра [ * _ * * ]",
|
||||
2 => "3-я цифра [ * * _ * ]",
|
||||
3 => "4-я цифра [ * * * _ ]",
|
||||
_ => $"{positionIndex + 1}-я цифра"
|
||||
};
|
||||
|
||||
if (positionNoticeText != null)
|
||||
positionNoticeText.text = $"КОД ЛИФТА: {posStr}";
|
||||
|
||||
if (bigDigitText != null)
|
||||
bigDigitText.text = digit.ToString();
|
||||
|
||||
if (flavorBodyText != null)
|
||||
flavorBodyText.text = storyText;
|
||||
|
||||
GameAudioSynthesizer.PlayPaperRustle();
|
||||
|
||||
if (LevelCodeManager.Instance != null)
|
||||
{
|
||||
LevelCodeManager.Instance.DiscoverDigit(positionIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseNote()
|
||||
{
|
||||
if (!isOpen) return;
|
||||
|
||||
isOpen = false;
|
||||
if (notePanelRoot != null)
|
||||
notePanelRoot.SetActive(false);
|
||||
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
|
||||
GameAudioSynthesizer.PlayKeypadClear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b4c1b816e1241448a3a858ceaf38105
|
||||
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
// Обязательно добавляем библиотеку новой системы ввода
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
@@ -25,6 +25,7 @@ public class ObjectThrower : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Time.timeScale == 0f) return;
|
||||
// Защита от ошибок, если клавиатура не подключена
|
||||
if (Keyboard.current == null) return;
|
||||
|
||||
|
||||
+132
-83
@@ -12,9 +12,12 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
[Header("Кнопки панели действий")]
|
||||
public Button resumeButton;
|
||||
public Button settingsButton;
|
||||
public Button restartButton;
|
||||
public Button mainMenuButton;
|
||||
public Button quitButton;
|
||||
public Button backFromSettingsButton;
|
||||
public Button resetDefaultsButton;
|
||||
|
||||
[Header("Вкладки")]
|
||||
public Button[] tabButtons;
|
||||
@@ -38,7 +41,6 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
private bool isPaused = false;
|
||||
private bool isInitializing = false;
|
||||
private bool wasCursorLocked = false;
|
||||
private List<Resolution> filteredResolutions = new List<Resolution>();
|
||||
|
||||
public bool IsPaused => isPaused;
|
||||
@@ -58,14 +60,15 @@ public class PauseMenu : MonoBehaviour
|
||||
SetupActionButtons();
|
||||
SetupTabs();
|
||||
InitializeSettingsUI();
|
||||
|
||||
wasCursorLocked = (Cursor.lockState == CursorLockMode.Locked);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Не открываем меню паузы, если активен экран смерти
|
||||
// Не открываем меню паузы, если активен экран смерти, просмотр записки, клавиатура лифта или экран победы
|
||||
if (DeathScreenUI.Instance != null && DeathScreenUI.Instance.IsShown) return;
|
||||
if (NoteViewerUI.Instance != null && NoteViewerUI.Instance.IsOpen) return;
|
||||
if (ElevatorKeypadUI.Instance != null && ElevatorKeypadUI.Instance.IsOpen) return;
|
||||
if (LevelSuccessUI.Instance != null && LevelSuccessUI.Instance.IsOpen) return;
|
||||
|
||||
bool togglePause = false;
|
||||
var keyboard = Keyboard.current;
|
||||
@@ -73,30 +76,25 @@ public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
if (keyboard.escapeKey.wasPressedThisFrame ||
|
||||
keyboard.pKey.wasPressedThisFrame ||
|
||||
keyboard.tabKey.wasPressedThisFrame ||
|
||||
keyboard.pauseKey.wasPressedThisFrame)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
var gamepad = Gamepad.current;
|
||||
if (gamepad != null && gamepad.startButton.wasPressedThisFrame)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
// В Unity Editor при заблокированном курсоре нажатие Escape перехватывается редактором
|
||||
// для снятия блокировки курсора (Cursor.lockState переключается в None) и не передается в Update().
|
||||
// Поэтому в редакторе переключение lockState из Locked в None трактуется как нажатие Escape!
|
||||
if (!isPaused && wasCursorLocked && Cursor.lockState != CursorLockMode.Locked)
|
||||
{
|
||||
togglePause = true;
|
||||
}
|
||||
wasCursorLocked = (Cursor.lockState == CursorLockMode.Locked);
|
||||
#endif
|
||||
|
||||
if (togglePause)
|
||||
{
|
||||
if (isPaused)
|
||||
@@ -123,7 +121,6 @@ public class PauseMenu : MonoBehaviour
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
wasCursorLocked = false;
|
||||
|
||||
if (pauseMenuPanel != null)
|
||||
{
|
||||
@@ -145,7 +142,6 @@ public class PauseMenu : MonoBehaviour
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
wasCursorLocked = true;
|
||||
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(false);
|
||||
if (settingsPanel != null) settingsPanel.SetActive(false);
|
||||
@@ -163,7 +159,12 @@ public class PauseMenu : MonoBehaviour
|
||||
public void OpenSettings()
|
||||
{
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(false);
|
||||
if (settingsPanel != null) settingsPanel.SetActive(true);
|
||||
if (settingsPanel != null)
|
||||
{
|
||||
settingsPanel.SetActive(true);
|
||||
InitializeSettingsUI();
|
||||
SwitchTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseSettings()
|
||||
@@ -173,6 +174,50 @@ public class PauseMenu : MonoBehaviour
|
||||
if (pauseMenuPanel != null) pauseMenuPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void ResetToDefaults()
|
||||
{
|
||||
isInitializing = true;
|
||||
|
||||
if (volumeSlider != null) volumeSlider.value = 1.0f;
|
||||
if (muteToggle != null) muteToggle.isOn = false;
|
||||
PlayerPrefs.SetFloat(GameSettings.KeyMasterVolume, 1.0f);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyIsMuted, 0);
|
||||
AudioListener.volume = 1.0f;
|
||||
UpdateVolumeLabel(1.0f, false);
|
||||
|
||||
int defQuality = Mathf.Clamp(QualitySettings.names.Length - 1, 0, QualitySettings.names.Length - 1);
|
||||
if (qualityDropdown != null)
|
||||
{
|
||||
qualityDropdown.value = defQuality;
|
||||
qualityDropdown.RefreshShownValue();
|
||||
}
|
||||
QualitySettings.SetQualityLevel(defQuality, true);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyQualityLevel, defQuality);
|
||||
|
||||
if (fullscreenToggle != null) fullscreenToggle.isOn = true;
|
||||
Screen.fullScreen = true;
|
||||
PlayerPrefs.SetInt(GameSettings.KeyFullscreen, 1);
|
||||
|
||||
if (resolutionDropdown != null && filteredResolutions.Count > 0)
|
||||
{
|
||||
int lastIndex = filteredResolutions.Count - 1;
|
||||
resolutionDropdown.value = lastIndex;
|
||||
resolutionDropdown.RefreshShownValue();
|
||||
var res = filteredResolutions[lastIndex];
|
||||
Screen.SetResolution(res.width, res.height, FullScreenMode.FullScreenWindow);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyResolutionWidth, res.width);
|
||||
PlayerPrefs.SetInt(GameSettings.KeyResolutionHeight, res.height);
|
||||
}
|
||||
|
||||
if (sensitivitySlider != null) sensitivitySlider.value = 1.0f;
|
||||
PlayerPrefs.SetFloat(GameSettings.KeyMouseSensitivity, 1.0f);
|
||||
UpdateSensitivityLabel(1.0f);
|
||||
|
||||
PlayerPrefs.Save();
|
||||
isInitializing = false;
|
||||
Debug.Log("[PauseMenu] Настройки сброшены на значения по умолчанию.");
|
||||
}
|
||||
|
||||
public void ReturnToMainMenu()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
@@ -214,16 +259,16 @@ public class PauseMenu : MonoBehaviour
|
||||
if (img != null)
|
||||
{
|
||||
img.color = isActive
|
||||
? new Color(0.00f, 0.65f, 0.85f, 0.95f) // Неоновый бирюзовый акцент
|
||||
: new Color(0.06f, 0.10f, 0.16f, 0.85f); // Темный фон неактивной вкладки
|
||||
? new Color(0.95f, 0.78f, 0.12f, 1.0f) // Золотистый активный
|
||||
: new Color(0.08f, 0.08f, 0.08f, 0.85f);
|
||||
}
|
||||
|
||||
var text = tabButtons[i].GetComponentInChildren<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
text.color = isActive
|
||||
? Color.white
|
||||
: new Color(0.40f, 0.55f, 0.65f, 0.80f);
|
||||
? new Color(0.06f, 0.06f, 0.06f, 1.0f)
|
||||
: new Color(0.6f, 0.6f, 0.6f, 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,8 +282,11 @@ public class PauseMenu : MonoBehaviour
|
||||
for (int i = 0; i < tabButtons.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
tabButtons[i].onClick.RemoveAllListeners();
|
||||
tabButtons[i].onClick.AddListener(() => SwitchTab(index));
|
||||
if (tabButtons[i] != null)
|
||||
{
|
||||
tabButtons[i].onClick.RemoveAllListeners();
|
||||
tabButtons[i].onClick.AddListener(() => SwitchTab(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,6 +299,12 @@ public class PauseMenu : MonoBehaviour
|
||||
resumeButton.onClick.AddListener(ResumeGame);
|
||||
}
|
||||
|
||||
if (settingsButton != null)
|
||||
{
|
||||
settingsButton.onClick.RemoveAllListeners();
|
||||
settingsButton.onClick.AddListener(OpenSettings);
|
||||
}
|
||||
|
||||
if (restartButton != null)
|
||||
{
|
||||
restartButton.onClick.RemoveAllListeners();
|
||||
@@ -268,81 +322,76 @@ public class PauseMenu : MonoBehaviour
|
||||
quitButton.onClick.RemoveAllListeners();
|
||||
quitButton.onClick.AddListener(QuitGame);
|
||||
}
|
||||
|
||||
if (backFromSettingsButton != null)
|
||||
{
|
||||
backFromSettingsButton.onClick.RemoveAllListeners();
|
||||
backFromSettingsButton.onClick.AddListener(CloseSettings);
|
||||
}
|
||||
|
||||
if (resetDefaultsButton != null)
|
||||
{
|
||||
resetDefaultsButton.onClick.RemoveAllListeners();
|
||||
resetDefaultsButton.onClick.AddListener(ResetToDefaults);
|
||||
}
|
||||
}
|
||||
|
||||
public void AutoWireUI()
|
||||
{
|
||||
if (pauseMenuPanel == null)
|
||||
{
|
||||
var root = transform.Find("PauseRootPanel");
|
||||
if (root != null)
|
||||
{
|
||||
pauseMenuPanel = root.gameObject;
|
||||
}
|
||||
var pPanel = transform.Find("PauseMenuPanel");
|
||||
if (pPanel != null) pauseMenuPanel = pPanel.gameObject;
|
||||
else
|
||||
{
|
||||
var panel = transform.Find("PauseMenuPanel");
|
||||
if (panel != null) pauseMenuPanel = panel.gameObject;
|
||||
var root = transform.Find("PauseRootPanel");
|
||||
if (root != null) pauseMenuPanel = root.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
Transform window = transform.Find("PauseRootPanel/Settings_Window");
|
||||
if (window != null)
|
||||
if (settingsPanel == null)
|
||||
{
|
||||
var winRt = window.GetComponent<RectTransform>();
|
||||
if (winRt != null && (winRt.sizeDelta.x <= 0f || winRt.sizeDelta.y <= 0f))
|
||||
var sPanel = transform.Find("SettingsPanel");
|
||||
if (sPanel != null) settingsPanel = sPanel.gameObject;
|
||||
}
|
||||
|
||||
// Кнопки в карточке паузы
|
||||
Transform pauseCard = transform.Find("PauseMenuPanel/Pause_Card") ?? transform.Find("PauseMenuPanel");
|
||||
if (pauseCard != null)
|
||||
{
|
||||
Transform btnBox = pauseCard.Find("Buttons_Container") ?? pauseCard;
|
||||
if (resumeButton == null) resumeButton = btnBox.Find("Btn_Resume")?.GetComponent<Button>();
|
||||
if (settingsButton == null) settingsButton = btnBox.Find("Btn_Settings")?.GetComponent<Button>();
|
||||
if (restartButton == null) restartButton = btnBox.Find("Btn_Restart")?.GetComponent<Button>();
|
||||
if (mainMenuButton == null) mainMenuButton = btnBox.Find("Btn_MainMenu")?.GetComponent<Button>();
|
||||
if (quitButton == null) quitButton = btnBox.Find("Btn_Quit")?.GetComponent<Button>();
|
||||
}
|
||||
|
||||
// Кнопки и контролы в SettingsPanel
|
||||
Transform sCard = transform.Find("SettingsPanel/Settings_Card");
|
||||
if (sCard != null)
|
||||
{
|
||||
Transform bottomBtns = sCard.Find("Settings_BottomButtons");
|
||||
if (bottomBtns != null)
|
||||
{
|
||||
winRt.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
winRt.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
winRt.pivot = new Vector2(0.5f, 0.5f);
|
||||
winRt.anchoredPosition = Vector2.zero;
|
||||
winRt.sizeDelta = new Vector2(1100f, 720f);
|
||||
if (resetDefaultsButton == null) resetDefaultsButton = bottomBtns.Find("Button_ResetDefaults")?.GetComponent<Button>();
|
||||
if (backFromSettingsButton == null) backFromSettingsButton = bottomBtns.Find("Button_Back")?.GetComponent<Button>();
|
||||
}
|
||||
|
||||
Transform dock = window.Find("Bottom_Action_Dock");
|
||||
if (dock != null)
|
||||
Transform sList = sCard.Find("Settings_List");
|
||||
if (sList != null)
|
||||
{
|
||||
if (resumeButton == null) resumeButton = dock.Find("Btn_Resume")?.GetComponent<Button>();
|
||||
if (restartButton == null) restartButton = dock.Find("Btn_Restart")?.GetComponent<Button>();
|
||||
if (mainMenuButton == null) mainMenuButton = dock.Find("Btn_MainMenu")?.GetComponent<Button>();
|
||||
if (quitButton == null) quitButton = dock.Find("Btn_Quit")?.GetComponent<Button>();
|
||||
if (volumeSlider == null) volumeSlider = sList.Find("Row_Volume/Slider")?.GetComponent<Slider>();
|
||||
if (volumeValueText == null) volumeValueText = sList.Find("Row_Volume/ValueText")?.GetComponent<Text>();
|
||||
if (muteToggle == null) muteToggle = sList.Find("Row_Mute/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (qualityDropdown == null) qualityDropdown = sList.Find("Row_Quality/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (fullscreenToggle == null) fullscreenToggle = sList.Find("Row_Fullscreen/Toggle")?.GetComponent<Toggle>();
|
||||
if (resolutionDropdown == null) resolutionDropdown = sList.Find("Row_Resolution/Dropdown")?.GetComponent<Dropdown>();
|
||||
|
||||
if (sensitivitySlider == null) sensitivitySlider = sList.Find("Row_Sensitivity/Slider")?.GetComponent<Slider>();
|
||||
if (sensitivityValueText == null) sensitivityValueText = sList.Find("Row_Sensitivity/ValueText")?.GetComponent<Text>();
|
||||
}
|
||||
|
||||
Transform tabBar = window.Find("Tab_Bar");
|
||||
Transform content = window.Find("Content_Area");
|
||||
|
||||
if (tabBar != null && (tabButtons == null || tabButtons.Length == 0))
|
||||
{
|
||||
tabButtons = new Button[tabBar.childCount];
|
||||
for (int i = 0; i < tabBar.childCount; i++)
|
||||
{
|
||||
tabButtons[i] = tabBar.GetChild(i).GetComponent<Button>();
|
||||
}
|
||||
}
|
||||
|
||||
if (content != null && (tabPanels == null || tabPanels.Length == 0))
|
||||
{
|
||||
tabPanels = new GameObject[]
|
||||
{
|
||||
content.Find("Panel_Audio")?.gameObject,
|
||||
content.Find("Panel_Graphics")?.gameObject,
|
||||
content.Find("Panel_Controls")?.gameObject,
|
||||
content.Find("Panel_Briefing")?.gameObject
|
||||
};
|
||||
}
|
||||
|
||||
if (volumeSlider == null) volumeSlider = content?.Find("Panel_Audio/Row_Volume/Slider")?.GetComponent<Slider>();
|
||||
if (volumeValueText == null) volumeValueText = content?.Find("Panel_Audio/Row_Volume/ValueText")?.GetComponent<Text>();
|
||||
if (muteToggle == null) muteToggle = content?.Find("Panel_Audio/Row_Mute/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (qualityDropdown == null) qualityDropdown = content?.Find("Panel_Graphics/Row_Quality/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (fullscreenToggle == null) fullscreenToggle = content?.Find("Panel_Graphics/Row_Fullscreen/Toggle")?.GetComponent<Toggle>();
|
||||
if (resolutionDropdown == null) resolutionDropdown = content?.Find("Panel_Graphics/Row_Resolution/Dropdown")?.GetComponent<Dropdown>();
|
||||
if (vsyncToggle == null) vsyncToggle = content?.Find("Panel_Graphics/Row_Vsync/Toggle")?.GetComponent<Toggle>();
|
||||
|
||||
if (sensitivitySlider == null) sensitivitySlider = content?.Find("Panel_Controls/Row_Sensitivity/Slider")?.GetComponent<Slider>();
|
||||
if (sensitivityValueText == null) sensitivityValueText = content?.Find("Panel_Controls/Row_Sensitivity/ValueText")?.GetComponent<Text>();
|
||||
if (invertYToggle == null) invertYToggle = content?.Find("Panel_Controls/Row_InvertY/Toggle")?.GetComponent<Toggle>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04fa2d49319ab014594033997cfc4a0d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,144 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07bdb058341eaf64fbfadca21c57cf6f
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: 6475078783708840200
|
||||
second: TornPaper_Sprite_0
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationMethod: 0
|
||||
spriteTessellationDetail: -1
|
||||
spriteGeometrySubdivision: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: TornPaper_Sprite_0
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1024
|
||||
height: 1024
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 80142abe8d91cd950800000000000000
|
||||
internalID: 6475078783708840200
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -100,11 +100,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -143,9 +143,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0.5849056, g: 0.5849056, b: 0.5849056, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _WaveCenter: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
@@ -105,11 +105,11 @@ Material:
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _EchoOpacity1: 0.5927114
|
||||
- _EchoOpacity2: 0
|
||||
- _EchoOpacity1: 0
|
||||
- _EchoOpacity2: 0.3193835
|
||||
- _EchoOpacity3: 0
|
||||
- _EchoRadius1: 5.386
|
||||
- _EchoRadius2: 0
|
||||
- _EchoRadius1: 0
|
||||
- _EchoRadius2: 4.493115
|
||||
- _EchoRadius3: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelPower: 2.5
|
||||
@@ -158,9 +158,9 @@ Material:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0.2901961}
|
||||
- _EchoColor: {r: 4, g: 3.026, b: 1.049, a: 1}
|
||||
- _EchoCoreColor: {r: 7.5, g: 5.5, b: 2.2, a: 1}
|
||||
- _EchoPosition1: {r: -43.056625, g: -0.029093798, b: 23.00288, a: 1}
|
||||
- _EchoPosition2: {r: -40.5, g: -0.027898155, b: -6, a: 1}
|
||||
- _EchoPosition3: {r: -35.5, g: -0.027898155, b: -14, a: 1}
|
||||
- _EchoPosition1: {r: -37.285122, g: 0.12999992, b: -36.339718, a: 1}
|
||||
- _EchoPosition2: {r: -36.50726, g: 0.12999992, b: -36.424538, a: 1}
|
||||
- _EchoPosition3: {r: -37.424873, g: 0.13000004, b: -36.465725, a: 1}
|
||||
- _EmissionColor: {r: 0.3018868, g: 0.3018868, b: 0.3018868, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _UvOffset: {r: 0, g: 0, b: 0, a: 0}
|
||||
|
||||
Reference in new issue
Block a user