new cut scene
This commit is contained in:
8
Assets/Animations/CUT_SCENES/Ch01.meta
Normal file
8
Assets/Animations/CUT_SCENES/Ch01.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 188fd02714b484e49bfa96039bc1e392
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
411
Assets/Animations/CUT_SCENES/Ch01/1=INTRO Timeline.playable
Normal file
411
Assets/Animations/CUT_SCENES/Ch01/1=INTRO Timeline.playable
Normal file
@@ -0,0 +1,411 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &-859534869099360747
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Recorded
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: {x: -0.2594174, y: 0.023329636, z: -0.0017030062, w: 0.965482}
|
||||
inSlope: {x: 0, y: 0, z: 0, w: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0, w: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334, w: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334, w: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: {x: -3.2623901, y: -6.5103493, z: 5.936325}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: {x: -1.2279587, y: 2.623518, z: 21.771622}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 1
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 0
|
||||
attribute: 2
|
||||
script: {fileID: 0}
|
||||
typeID: 4
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 13.5
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -3.2623901
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: -1.2279587
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: -6.5103493
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: 2.623518
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 5.936325
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: 21.771622
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: -0.2594174
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalRotation.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: 0.023329636
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalRotation.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: -0.0017030062
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalRotation.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: 0.965482
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalRotation.w
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: -30.056
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: localEulerAngles.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: 3.042
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: localEulerAngles.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 13.5
|
||||
value: -1.019
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: localEulerAngles.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_HasGenericRootTransform: 1
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3}
|
||||
m_Name: 1=INTRO Timeline
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 0
|
||||
m_Tracks:
|
||||
- {fileID: 5874915745532767768}
|
||||
m_FixedDuration: 0
|
||||
m_EditorSettings:
|
||||
m_Framerate: 60
|
||||
m_ScenePreview: 1
|
||||
m_DurationMode: 0
|
||||
m_MarkerTrack: {fileID: 0}
|
||||
--- !u!114 &5874915745532767768
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d21dcc2386d650c4597f3633c75a1f98, type: 3}
|
||||
m_Name: Animation Track
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 3
|
||||
m_AnimClip: {fileID: 0}
|
||||
m_Locked: 0
|
||||
m_Muted: 0
|
||||
m_CustomPlayableFullTypename:
|
||||
m_Curves: {fileID: 0}
|
||||
m_Parent: {fileID: 11400000}
|
||||
m_Children: []
|
||||
m_Clips: []
|
||||
m_Markers:
|
||||
m_Objects: []
|
||||
m_InfiniteClipPreExtrapolation: 1
|
||||
m_InfiniteClipPostExtrapolation: 1
|
||||
m_InfiniteClipOffsetPosition: {x: 198.97739, y: 47.109066, z: -37.82186}
|
||||
m_InfiniteClipOffsetEulerAngles: {x: 19.491459, y: 313.38037, z: 0.01985787}
|
||||
m_InfiniteClipTimeOffset: 0
|
||||
m_InfiniteClipRemoveOffset: 0
|
||||
m_InfiniteClipApplyFootIK: 1
|
||||
mInfiniteClipLoop: 0
|
||||
m_MatchTargetFields: 63
|
||||
m_Position: {x: 0, y: 0, z: 0}
|
||||
m_EulerAngles: {x: 0, y: 0, z: 0}
|
||||
m_AvatarMask: {fileID: 0}
|
||||
m_ApplyAvatarMask: 1
|
||||
m_TrackOffset: 0
|
||||
m_InfiniteClip: {fileID: -859534869099360747}
|
||||
m_OpenClipOffsetRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_ApplyOffsets: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe9d35c61a3110d4a8eb658971591e7f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -477,10 +477,10 @@ MonoBehaviour:
|
||||
active: 1
|
||||
postExposure:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
m_Value: 1.1
|
||||
contrast:
|
||||
m_OverrideState: 1
|
||||
m_Value: 27
|
||||
m_Value: 31
|
||||
colorFilter:
|
||||
m_OverrideState: 1
|
||||
m_Value: {r: 1, g: 1, b: 1, a: 1}
|
||||
|
||||
691568
Assets/Scenes/Land_01/demo_postptrocesINTRO.unity
Normal file
691568
Assets/Scenes/Land_01/demo_postptrocesINTRO.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/Land_01/demo_postptrocesINTRO.unity.meta
Normal file
7
Assets/Scenes/Land_01/demo_postptrocesINTRO.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e96c2977de1cfbd42842bca9554dc468
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -5,27 +5,35 @@ using UnityEngine;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
// Atrybut [InitializeOnLoad] musi byæ tutaj, nad deklaracj¹ klasy.
|
||||
// Dziêki niemu statyczny konstruktor tej klasy zostanie wywo³any automatycznie przez edytor.
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoad]
|
||||
#endif
|
||||
[ExecuteAlways]
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class URPFogZone_Master : MonoBehaviour
|
||||
{
|
||||
// --- Publiczne pola ---
|
||||
[Header("Ustawienia docelowe mg³y")]
|
||||
#region Ustawienia Publiczne
|
||||
[Header("Ustawienia Docelowe Mg³y")]
|
||||
public bool targetFogEnabled = true;
|
||||
public Color targetFogColor = new Color(0.5f, 0.5f, 0.5f);
|
||||
public FogMode targetFogMode = FogMode.Exponential;
|
||||
|
||||
[Header("Ustawienia dla trybu Exponential / Exp2")]
|
||||
[Range(0f, 1f)]
|
||||
public float targetFogDensity = 0.02f;
|
||||
|
||||
[Header("Ustawienia dla trybu Linear")]
|
||||
public float targetFogStartDistance = 0f;
|
||||
public float targetFogEndDistance = 300f;
|
||||
|
||||
[Header("Ustawienia przejœcia (tylko w trybie gry)")]
|
||||
[Header("Ustawienia Przejœcia (tylko w trybie gry)")]
|
||||
public float transitionDuration = 2.0f;
|
||||
public string triggerTag = "MainCamera";
|
||||
#endregion
|
||||
|
||||
// --- Prywatne i statyczne pola ---
|
||||
#region Pola Prywatne i Statyczne
|
||||
private static bool s_defaultsSaved = false;
|
||||
private static bool s_defaultFogEnabled;
|
||||
private static Color s_defaultFogColor;
|
||||
@@ -34,48 +42,32 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
private static float s_defaultFogStartDistance;
|
||||
private static float s_defaultFogEndDistance;
|
||||
|
||||
// NOWOŒÆ: Œledzi, która strefa jest obecnie aktywna.
|
||||
private static URPFogZone_Master s_activeZone = null;
|
||||
|
||||
private Coroutine transitionCoroutine;
|
||||
private Collider zoneCollider;
|
||||
#endregion
|
||||
|
||||
#region Logika dla Edytora
|
||||
#if UNITY_EDITOR
|
||||
private bool isEditorCameraInZone = false;
|
||||
#endif
|
||||
|
||||
// --- Cykl ¿ycia ---
|
||||
private void OnEnable()
|
||||
// Statyczny konstruktor. Wywo³ywany dziêki atrybutowi [InitializeOnLoad] nad klas¹.
|
||||
static URPFogZone_Master()
|
||||
{
|
||||
zoneCollider = GetComponent<Collider>();
|
||||
SaveDefaultFogSettings();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.update += EditorUpdate;
|
||||
#endif
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
private static void OnPlayModeStateChanged(PlayModeStateChange state)
|
||||
{
|
||||
// Jeœli ten obiekt by³ ostatni¹ aktywn¹ stref¹, przywróæ domyœlne ustawienia.
|
||||
if (s_activeZone == this)
|
||||
if (state == PlayModeStateChange.ExitingPlayMode)
|
||||
{
|
||||
if (transitionCoroutine != null) StopCoroutine(transitionCoroutine);
|
||||
RestoreDefaultSettings();
|
||||
s_defaultsSaved = false;
|
||||
s_activeZone = null;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.update -= EditorUpdate;
|
||||
#endif
|
||||
}
|
||||
|
||||
// --- Logika dla trybu edycji ---
|
||||
#if UNITY_EDITOR
|
||||
private void OnValidate()
|
||||
{
|
||||
if (Application.isPlaying) return;
|
||||
// Zastosuj zmiany tylko jeœli ta strefa jest aktywna
|
||||
if (s_activeZone == this)
|
||||
{
|
||||
ApplyTargetSettingsDirectly();
|
||||
@@ -89,29 +81,61 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
var sceneView = SceneView.lastActiveSceneView;
|
||||
if (sceneView == null || sceneView.camera == null) return;
|
||||
|
||||
if (zoneCollider == null) zoneCollider = GetComponent<Collider>();
|
||||
if (zoneCollider == null) return;
|
||||
|
||||
bool isCurrentlyInside = zoneCollider.bounds.Contains(sceneView.camera.transform.position);
|
||||
|
||||
// WEJŒCIE do strefy
|
||||
if (isCurrentlyInside && s_activeZone != this)
|
||||
{
|
||||
s_activeZone = this;
|
||||
isEditorCameraInZone = true;
|
||||
SaveDefaultFogSettings();
|
||||
ApplyTargetSettingsDirectly();
|
||||
}
|
||||
// WYJŒCIE ze strefy
|
||||
else if (!isCurrentlyInside && s_activeZone == this)
|
||||
{
|
||||
s_activeZone = null;
|
||||
isEditorCameraInZone = false;
|
||||
RestoreDefaultSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
||||
// --- Logika dla trybu gry ---
|
||||
#region Cykl ¯ycia Obiektu
|
||||
private void OnEnable()
|
||||
{
|
||||
zoneCollider = GetComponent<Collider>();
|
||||
zoneCollider.isTrigger = true;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
EditorApplication.update += EditorUpdate;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (s_activeZone == this)
|
||||
{
|
||||
if (transitionCoroutine != null) StopCoroutine(transitionCoroutine);
|
||||
RestoreDefaultSettings();
|
||||
s_activeZone = null;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
EditorApplication.update -= EditorUpdate;
|
||||
#endif
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Logika Trybu Gry
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!Application.isPlaying || !other.CompareTag(triggerTag)) return;
|
||||
|
||||
SaveDefaultFogSettings();
|
||||
s_activeZone = this;
|
||||
StartTransition(true);
|
||||
}
|
||||
@@ -119,18 +143,51 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (!Application.isPlaying || !other.CompareTag(triggerTag)) return;
|
||||
// Przywróæ domyœlne tylko jeœli opuszczamy TÊ aktywn¹ strefê.
|
||||
|
||||
if (s_activeZone == this)
|
||||
{
|
||||
s_activeZone = null;
|
||||
StartTransition(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// --- Wspólne metody ---
|
||||
// =================================================================================
|
||||
#region NOWOή: Publiczne Metody do sterowania przez Eventy (dla Cutscen)
|
||||
|
||||
/// <summary>
|
||||
/// Aktywuje mg³ê z tej strefy. Podepnij tê funkcjê pod event na pocz¹tku cutsceny.
|
||||
/// </summary>
|
||||
public void ActivateZoneFog()
|
||||
{
|
||||
Debug.Log($"[FogZone] Rêczna aktywacja mg³y dla strefy: {gameObject.name}", this);
|
||||
SaveDefaultFogSettings();
|
||||
s_activeZone = this;
|
||||
StartTransition(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Przywraca domyœlne ustawienia mg³y. Podepnij tê funkcjê pod event na koñcu cutsceny.
|
||||
/// </summary>
|
||||
public void RevertToDefaultFog()
|
||||
{
|
||||
// Sprawdzamy, czy TA strefa jest aktywna. To wa¿ne zabezpieczenie.
|
||||
if (s_activeZone == this)
|
||||
{
|
||||
Debug.Log($"[FogZone] Rêczne przywracanie domyœlnej mg³y ze strefy: {gameObject.name}", this);
|
||||
s_activeZone = null;
|
||||
StartTransition(false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
// =================================================================================
|
||||
|
||||
#region Metody G³ówne
|
||||
private static void SaveDefaultFogSettings()
|
||||
{
|
||||
if (s_defaultsSaved) return;
|
||||
|
||||
s_defaultFogEnabled = RenderSettings.fog;
|
||||
s_defaultFogColor = RenderSettings.fogColor;
|
||||
s_defaultFogMode = RenderSettings.fogMode;
|
||||
@@ -140,6 +197,22 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
s_defaultsSaved = true;
|
||||
}
|
||||
|
||||
private static void RestoreDefaultSettings()
|
||||
{
|
||||
if (!s_defaultsSaved) return;
|
||||
|
||||
RenderSettings.fog = s_defaultFogEnabled;
|
||||
RenderSettings.fogColor = s_defaultFogColor;
|
||||
RenderSettings.fogMode = s_defaultFogMode;
|
||||
RenderSettings.fogDensity = s_defaultFogDensity;
|
||||
RenderSettings.fogStartDistance = s_defaultFogStartDistance;
|
||||
RenderSettings.fogEndDistance = s_defaultFogEndDistance;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
SceneView.RepaintAll();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void ApplyTargetSettingsDirectly()
|
||||
{
|
||||
RenderSettings.fog = targetFogEnabled;
|
||||
@@ -148,20 +221,7 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
RenderSettings.fogDensity = targetFogDensity;
|
||||
RenderSettings.fogStartDistance = targetFogStartDistance;
|
||||
RenderSettings.fogEndDistance = targetFogEndDistance;
|
||||
#if UNITY_EDITOR
|
||||
SceneView.RepaintAll();
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void RestoreDefaultSettings()
|
||||
{
|
||||
if (!s_defaultsSaved) return;
|
||||
RenderSettings.fog = s_defaultFogEnabled;
|
||||
RenderSettings.fogColor = s_defaultFogColor;
|
||||
RenderSettings.fogMode = s_defaultFogMode;
|
||||
RenderSettings.fogDensity = s_defaultFogDensity;
|
||||
RenderSettings.fogStartDistance = s_defaultFogStartDistance;
|
||||
RenderSettings.fogEndDistance = s_defaultFogEndDistance;
|
||||
#if UNITY_EDITOR
|
||||
SceneView.RepaintAll();
|
||||
#endif
|
||||
@@ -169,11 +229,14 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
|
||||
private void StartTransition(bool toTarget)
|
||||
{
|
||||
if (transitionCoroutine != null) StopCoroutine(transitionCoroutine);
|
||||
if (transitionCoroutine != null)
|
||||
{
|
||||
StopCoroutine(transitionCoroutine);
|
||||
}
|
||||
transitionCoroutine = StartCoroutine(TransitionFogCoroutine(toTarget));
|
||||
}
|
||||
|
||||
IEnumerator TransitionFogCoroutine(bool toTarget)
|
||||
private IEnumerator TransitionFogCoroutine(bool toTarget)
|
||||
{
|
||||
float elapsed = 0f;
|
||||
Color startColor = RenderSettings.fogColor;
|
||||
@@ -186,20 +249,46 @@ public class URPFogZone_Master : MonoBehaviour
|
||||
float finalStartDist = toTarget ? targetFogStartDistance : s_defaultFogStartDistance;
|
||||
float finalEndDist = toTarget ? targetFogEndDistance : s_defaultFogEndDistance;
|
||||
|
||||
RenderSettings.fog = toTarget ? targetFogEnabled : s_defaultFogEnabled;
|
||||
RenderSettings.fogMode = toTarget ? targetFogMode : s_defaultFogMode;
|
||||
if (toTarget)
|
||||
{
|
||||
RenderSettings.fog = targetFogEnabled;
|
||||
RenderSettings.fogMode = targetFogMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderSettings.fogMode = s_defaultFogMode;
|
||||
}
|
||||
|
||||
if (transitionDuration <= 0f)
|
||||
{
|
||||
RenderSettings.fogColor = finalColor;
|
||||
RenderSettings.fogDensity = finalDensity;
|
||||
RenderSettings.fogStartDistance = finalStartDist;
|
||||
RenderSettings.fogEndDistance = finalEndDist;
|
||||
if (!toTarget) RenderSettings.fog = s_defaultFogEnabled;
|
||||
yield break;
|
||||
}
|
||||
|
||||
while (elapsed < transitionDuration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float t = (transitionDuration > 0) ? Mathf.Clamp01(elapsed / transitionDuration) : 1f;
|
||||
// U¿ywam unscaledDeltaTime, aby dzia³a³o poprawnie w cutscenach
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float t = Mathf.Clamp01(elapsed / transitionDuration);
|
||||
|
||||
RenderSettings.fogColor = Color.Lerp(startColor, finalColor, t);
|
||||
RenderSettings.fogDensity = Mathf.Lerp(startDensity, finalDensity, t);
|
||||
RenderSettings.fogStartDistance = Mathf.Lerp(startStartDist, finalStartDist, t);
|
||||
RenderSettings.fogEndDistance = Mathf.Lerp(startEndDist, finalEndDist, t);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (!toTarget)
|
||||
{
|
||||
RenderSettings.fog = s_defaultFogEnabled;
|
||||
}
|
||||
|
||||
transitionCoroutine = null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user