Merge branch 'NewStory' of http://185.56.209.148/beyond/beyond into NewStory

This commit is contained in:
2025-07-18 12:33:23 +02:00
15 changed files with 10816 additions and 1297 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 01ef02a204055ee45bf3e4c441cc789c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,136 @@
fileFormatVersion: 2
guid: b6ef3eadb8da6104e8dd2aff4c0fe306
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 0
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations:
- serializedVersion: 16
name: Intro_idle01
takeName: bazyl wisi
internalID: -2527803965097817264
firstFrame: 0
lastFrame: 520
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
hasAdditiveReferencePose: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 3
maskSource: {instanceID: 0}
additiveReferencePoseFrame: 0
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,7 @@ Material:
m_ValidKeywords:
- BASETEXTYPE_ALBEDO_EMISSIVE
- USEDISSOLVE_DONT_USE
- USEFRESNEL
m_InvalidKeywords: []
m_LightmapFlags: 6
m_EnableInstancingVariants: 0
@@ -170,7 +171,7 @@ Material:
- Smoothness: 0.26
- USEDISSOLVE: 0
- USEDISSOLVEMASK: 0
- USEFRESNEL: 0
- USEFRESNEL: 1
- Vector1_473704f964214ae2bc68475022d1524b: 0.05
- Vector1_96E66192: 1.86
- Vector1_B59CCC1A: 1.51
@@ -250,12 +251,12 @@ Material:
- EmissiveColor: {r: 0, g: 0, b: 0, a: 0}
- _AlbedoColor: {r: 1, g: 1, b: 1, a: 1}
- _BVCTint: {r: 0, g: 0, b: 0, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColor: {r: 0.24528301, g: 0.24528301, b: 0.24528301, a: 1}
- _BendVector: {r: 0, g: -1, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CubemapColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FresnelColor: {r: 0, g: 0.7648864, b: 1, a: 0}
- _FresnelColor: {r: 0.16981131, g: 0.009766485, b: 0, a: 0}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _RimColor: {r: 0.39141783, g: 0.44313726, b: 0, a: 0}
- _ScanWaveColor: {r: 0, g: 0.5949242, b: 1, a: 0}

View File

@@ -0,0 +1,279 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: DryTree1_2_mat 2
m_Shader: {fileID: -6465566751694194690, guid: 00a0b3897399f8b42a61a0333dd40ced,
type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- BASETEXTYPE_ALBEDO_EMISSIVE
- USEDISSOLVE_DONT_USE
- _ALPHATEST_ON
- _USEDISTANCEFADE
m_InvalidKeywords: []
m_LightmapFlags: 6
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- BaseTex:
m_Texture: {fileID: 2800000, guid: 4d6f8a642a104b54583e6fb186ba066d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- DissolveMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- NOSMap:
m_Texture: {fileID: 2800000, guid: 44c20449e2793f547be2fc5a46304eff, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Albedo:
m_Texture: {fileID: 2800000, guid: a613732619e8a7b4187abcfae25c72d3, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _AlbedoDetail:
m_Texture: {fileID: 2800000, guid: d1db5a7febe3ef5449b063a3dd27521e, type: 3}
m_Scale: {x: 3.18, y: 19.81}
m_Offset: {x: 0, y: 0}
- _BVCNormals:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 2800000, guid: d0fa3044ff9bc8a409ade3d250a21376, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BlueVCAlbedo:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BlueVCMask:
m_Texture: {fileID: 2800000, guid: 7937c4e638262954985abb567fcbb3f4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: 44c20449e2793f547be2fc5a46304eff, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CubemapBlured:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 2800000, guid: 7937c4e638262954985abb567fcbb3f4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormals:
m_Texture: {fileID: 2800000, guid: 9f75c099850d16d40bc6b217d0bf0b47, type: 3}
m_Scale: {x: 1.12, y: 6.9}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: d0fa3044ff9bc8a409ade3d250a21376, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskMap:
m_Texture: {fileID: 2800000, guid: 3d49f853d2aa93642912a9e5eec9cb99, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MaskedDetailNormals:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicMap:
m_Texture: {fileID: 2800000, guid: be14a826ac644ed4e84fae5d8a2be2f1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 2800000, guid: 5090f8b4fc1eea04fbbff3cc8ff0437d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _RimMask:
m_Texture: {fileID: 2800000, guid: 32ae57b43f84c4d40bff7519f05acabb, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SmoothnessMap:
m_Texture: {fileID: 2800000, guid: f10963276198cc04cb694845660ee5ce, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- AOStrength: 3
- AlphaClipThreshold: 0.5
- BASETEXTYPE: 0
- DissolveNoiseScale: 25
- EffectStrenght: 0
- FADESHADOWS: 1
- FresnelPower: 0
- Metalness: 0.06
- NormalStrength: 2.03
- Smoothness: 0.09
- USEDISSOLVE: 0
- USEDISSOLVEMASK: 0
- USEFRESNEL: 0
- Vector1_473704f964214ae2bc68475022d1524b: 0
- Vector1_96E66192: 1.86
- Vector1_B59CCC1A: 1.51
- _AlbedoDetailStrenth: 0.3
- _AlphaClip: 1
- _AlphaToMask: 1
- _BVCNormalsScale: 1
- _BendEffect: 0
- _BendMaxDistance: 0
- _BendMaxHeight: 0
- _BendMinDistance: 0
- _BendMinHeight: 0
- _Blend: 0
- _BlendModePreserveSpecular: 0
- _BumpScale: 1.51
- _CastShadows: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DetailNormalsScale: 0.41
- _DstBlend: 0
- _EffectThreshold: 0
- _EmissionMultiplayer: 0
- _EmissionSwitch: 0
- _EnvironmentReflections: 1
- _FadeDistance: 1.54
- _FarFadeDistance: 500
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossinessSource: 0
- _GlossyReflections: 1
- _InverseFadeRange: 2
- _InverseFarFadeRange: 0.5
- _MaskContrast: 1
- _MaskIntensity: 0
- _MetalicBrightnes: 1
- _Metallic: 0
- _Mode: 0
- _NormalMapDepth: 1
- _OcclusionStrength: 1
- _ParalaxOffset: 0.001
- _Parallax: 0
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _RimPower: 1.73
- _RimScale: 1
- _Shininess: 0
- _SmoothFromMapSwitch: 1
- _SmoothRough: 0
- _Smoothness: 0
- _SmoothnessSource: 0
- _SmoothnessTextureChannel: 0
- _Snoothness: 1
- _SpecSource: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _Threshold: 0
- _Tiling: 1
- _USEDISTANCEFADE: 1
- _USESCANWAVE: 0
- _UVSec: 0
- _WaveTrail: 0
- _WorkflowMode: 1
- _ZTest: 4
- _ZWrite: 1
- _ZWriteControl: 0
- __dirty: 0
m_Colors:
- BaseColor: {r: 1, g: 1, b: 1, a: 1}
- Color_613d1588816440ec9b17710effb7528b: {r: 0, g: 13.98681, b: 714.8679, a: 0}
- EmissiveColor: {r: 0, g: 0, b: 0, a: 0}
- _AlbedoColor: {r: 1, g: 1, b: 1, a: 1}
- _BVCTint: {r: 0, g: 0, b: 0, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BendVector: {r: 0, g: -1, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CubemapColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FresnelColor: {r: 0, g: 0.7648864, b: 1, a: 0}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _RimColor: {r: 0.39141783, g: 0.44313726, b: 0, a: 0}
- _ScanWaveColor: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tiling: {r: 1, g: 1, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &1382432393584054474
MonoBehaviour:
m_ObjectHideFlags: 11
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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e61f9b0d9df95f408a636770a883971
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -269,13 +269,13 @@ MonoBehaviour:
active: 1
lift:
m_OverrideState: 1
m_Value: {x: 1, y: 0.89784795, z: 0.8635659, w: 0}
m_Value: {x: 1, y: 0.93614525, z: 0.9014786, w: 0}
gamma:
m_OverrideState: 1
m_Value: {x: 0.9233657, y: 1, z: 0.9619515, w: -0.0416171}
m_Value: {x: 0.93532014, y: 1, z: 0.94183534, w: -0.0416171}
gain:
m_OverrideState: 1
m_Value: {x: 0.95255965, y: 1, z: 0.98172337, w: 0}
m_Value: {x: 0.94807005, y: 0.9589062, z: 1, w: 0}
--- !u!114 &-1517730986388215002
MonoBehaviour:
m_ObjectHideFlags: 3
@@ -288,10 +288,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 0
active: 1
temperature:
m_OverrideState: 1
m_Value: -10.5
m_Value: -11
tint:
m_OverrideState: 1
m_Value: 0
@@ -455,7 +455,7 @@ MonoBehaviour:
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.137
m_Value: 0.133
smoothness:
m_OverrideState: 1
m_Value: 0.651
@@ -480,7 +480,7 @@ MonoBehaviour:
m_Value: 1.64
contrast:
m_OverrideState: 1
m_Value: 21.9
m_Value: 3.4
colorFilter:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
@@ -505,13 +505,13 @@ MonoBehaviour:
active: 1
shadows:
m_OverrideState: 1
m_Value: {x: 0.81276786, y: 0.8717928, z: 1, w: 0.051389102}
m_Value: {x: 0.81276786, y: 0.8717928, z: 1, w: 0.00027089103}
midtones:
m_OverrideState: 1
m_Value: {x: 1, y: 0.9743214, z: 0.95878255, w: -0.10620759}
m_Value: {x: 1, y: 0.9743214, z: 0.95878255, w: -0.0063897776}
highlights:
m_OverrideState: 1
m_Value: {x: 1, y: 0.97544855, z: 0.9996057, w: -0.017513134}
m_Value: {x: 1, y: 0.97544855, z: 0.9996057, w: 0.19973926}
shadowsStart:
m_OverrideState: 0
m_Value: 0
@@ -539,7 +539,7 @@ MonoBehaviour:
active: 1
shadows:
m_OverrideState: 1
m_Value: {r: 0.3490566, g: 0.3490566, b: 0.3490566, a: 1}
m_Value: {r: 0.3962264, g: 0.3962264, b: 0.3962264, a: 1}
highlights:
m_OverrideState: 1
m_Value: {r: 0.46226418, g: 0.38975215, b: 0.34669814, a: 1}

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
// Ten nawias otwiera przestrzeń nazw 'Beyond'
namespace Beyond
{
[RequireComponent(typeof(Renderer))]
// Ten nawias otwiera klasę 'Billboard'
public class Billboard : MonoBehaviour
{
void Update()
{
if (Camera.main)
{
[Tooltip("Referencja do kamery, w stronę której obiekt ma patrzeć. Jeśli puste, automatycznie użyje Camera.main.")]
[SerializeField] private Camera _cameraToLookAt;
//Vector3 righ = Vector3.Cross(Camera.main.transform.forward, Vector3.up);
//transform.rotation = Quaternion.Euler(new Vector3(0f, Camera.main.transform.eulerAngles.y, 0f));
transform.rotation = Quaternion.LookRotation(-Camera.main.transform.forward, Vector3.up);
[Tooltip("Jak szybko obiekt ma się obracać w stronę kamery. Ustaw na dużą wartość (np. 1000) dla natychmiastowego obrotu.")]
[SerializeField] private float _rotationSpeed = 20f;
[Tooltip("Czy zablokować rotację na osi X, aby obiekt obracał się tylko w poziomie? Przydatne dla sprajtów 2D w świecie 3D.")]
[SerializeField] private bool _lockXAxis = false;
void Awake()
{
// Jeśli w Inspektorze nie przypisano żadnej kamery, spróbuj znaleźć główną kamerę przy starcie.
if (_cameraToLookAt == null)
{
_cameraToLookAt = Camera.main;
}
}
}
}
// Używamy LateUpdate(), aby mieć pewność, że wykonujemy obrót PO tym,
// jak kamera zaktualizowała swoją pozycję i rotację w danej klatce.
void LateUpdate()
{
if (_cameraToLookAt == null)
{
// Jeśli nadal nie ma kamery (np. główna została wyłączona), nie rób nic.
return;
}
// Oblicz docelową rotację
Quaternion targetRotation;
if (_lockXAxis)
{
// Wersja z zablokowaną osią X (obraca się tylko w lewo/prawo)
Vector3 cameraPosition = _cameraToLookAt.transform.position;
cameraPosition.y = transform.position.y;
targetRotation = Quaternion.LookRotation(transform.position - cameraPosition, Vector3.up);
}
else
{
// Wersja pełna (klasyczny billboard)
targetRotation = _cameraToLookAt.transform.rotation;
}
// Płynnie interpoluj (Slerp) od aktualnej rotacji do docelowej.
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, _rotationSpeed * Time.deltaTime);
}
} // <-- TEN ZNAK ZAMYKA KLASĘ 'Billboard'
} // <-- TEN ZNAK ZAMYKA PRZESTRZEŃ NAZW 'Beyond'

View File

@@ -0,0 +1,31 @@
using UnityEngine;
/// <summary>
/// JEDYNE <20>RÓD£O PRAWDY o domyœlnej mgle.
/// UmieϾ ten skrypt na JEDNYM obiekcie w scenie, np. "_FogManager".
/// </summary>
public class FogDefaultSettings : MonoBehaviour
{
public static FogDefaultSettings Instance { get; private set; }
[Header("Globalne Domyœlne Ustawienia Mg³y URP")]
public bool fogEnabled = true;
public Color fogColor = new Color(0.7f, 0.7f, 0.7f);
public FogMode fogMode = FogMode.Exponential;
[Range(0f, 1f)]
public float fogDensity = 0.01f;
public float fogStartDistance = 50f;
public float fogEndDistance = 1000f;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3e008175d2b553845ae2b295a6bf9a1c

View File

@@ -5,72 +5,190 @@ 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
/// <summary>
/// Zarz¹dza lokaln¹ stref¹ mg³y URP. Zmienia globalne ustawienia RenderSettings
/// z p³ynnym przejœciem. Dzia³a w trybie gry (triggery, eventy) oraz w edytorze (podgl¹d).
/// </summary>
[ExecuteAlways]
[RequireComponent(typeof(Collider))]
public class URPFogZone_Master : MonoBehaviour
public class FogZone : MonoBehaviour
{
#region Ustawienia Publiczne
[Header("Ustawienia Docelowe Mg³y")]
public bool targetFogEnabled = true;
[Header("Ustawienia Docelowe Mg³y (Wewn¹trz Strefy)")]
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 Zachowania")]
[Tooltip("Czas w sekundach, w jakim mg³a bêdzie p³ynnie przechodziæ do nowych ustawieñ.")]
public float transitionDuration = 2.0f;
public string triggerTag = "MainCamera";
#endregion
[Tooltip("Tag obiektu (zazwyczaj gracza), który ma aktywowaæ strefê.")]
public string playerTag = "Player";
#region Pola Prywatne i Statyczne
private static bool s_defaultsSaved = false;
private static bool s_defaultFogEnabled;
private static Color s_defaultFogColor;
private static FogMode s_defaultFogMode;
private static float s_defaultFogDensity;
private static float s_defaultFogStartDistance;
private static float s_defaultFogEndDistance;
[Header("Ustawienia Edytora")]
[Tooltip("W³¹cza podgl¹d mg³y w edytorze, gdy kamera Scene View wejdzie do strefy.")]
public bool enableEditorPreview = true;
private static URPFogZone_Master s_activeZone = null;
// Statyczne, by zapewniæ, ¿e tylko jedna zmiana mg³y dzieje siê naraz w ca³ej grze
private static Coroutine s_transitionCoroutine;
private static MonoBehaviour s_coroutineRunner;
private Coroutine transitionCoroutine;
private Collider zoneCollider;
#endregion
#region Logika dla Edytora
#if UNITY_EDITOR
// Statyczny konstruktor. Wywo³ywany dziêki atrybutowi [InitializeOnLoad] nad klas¹.
static URPFogZone_Master()
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void InitializeOnLoad()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
s_transitionCoroutine = null;
s_coroutineRunner = null;
}
private static void OnPlayModeStateChanged(PlayModeStateChange state)
// --- LOGIKA TRYBU GRY ---
private void OnTriggerEnter(Collider other)
{
if (state == PlayModeStateChange.ExitingPlayMode)
if (Application.isPlaying && other.CompareTag(playerTag))
{
s_defaultsSaved = false;
s_activeZone = null;
StartTransition(true);
}
}
private void OnValidate()
private void OnTriggerExit(Collider other)
{
if (Application.isPlaying) return;
if (s_activeZone == this)
if (Application.isPlaying && other.CompareTag(playerTag))
{
ApplyTargetSettingsDirectly();
StartTransition(false);
}
}
// --- PUBLICZNE METODY DLA EVENTÓW (CUTSCENY) ---
public void ActivateZoneFogFromEvent()
{
if (!Application.isPlaying) return;
StartTransition(true);
}
public void RevertToDefaultFogFromEvent()
{
if (!Application.isPlaying) return;
StartTransition(false);
}
// --- G£ÓWNA LOGIKA PRZEJŒCIA ---
private void StartTransition(bool toZoneSettings)
{
if (s_transitionCoroutine != null && s_coroutineRunner != null)
{
s_coroutineRunner.StopCoroutine(s_transitionCoroutine);
}
s_coroutineRunner = this;
s_transitionCoroutine = StartCoroutine(TransitionFog(toZoneSettings));
}
private IEnumerator TransitionFog(bool toZoneSettings)
{
Color startColor = RenderSettings.fogColor;
float startDensity = RenderSettings.fogDensity;
float startLinearStart = RenderSettings.fogStartDistance;
float startLinearEnd = RenderSettings.fogEndDistance;
Color endColor;
FogMode endMode;
float endDensity;
float endLinearStart;
float endLinearEnd;
if (toZoneSettings)
{
endColor = targetFogColor;
endMode = targetFogMode;
endDensity = targetFogDensity;
endLinearStart = targetFogStartDistance;
endLinearEnd = targetFogEndDistance;
RenderSettings.fogMode = endMode;
}
else
{
var defaults = FogDefaultSettings.Instance;
if (defaults == null)
{
Debug.LogError("Nie znaleziono FogDefaultSettings w scenie!", this);
yield break;
}
endColor = defaults.fogColor;
endMode = defaults.fogMode;
endDensity = defaults.fogDensity;
endLinearStart = defaults.fogStartDistance;
endLinearEnd = defaults.fogEndDistance;
}
RenderSettings.fog = true;
float elapsed = 0f;
while (elapsed < transitionDuration)
{
float t = (transitionDuration > 0) ? Mathf.Clamp01(elapsed / transitionDuration) : 1f;
RenderSettings.fogColor = Color.Lerp(startColor, endColor, t);
RenderSettings.fogDensity = Mathf.Lerp(startDensity, endDensity, t);
RenderSettings.fogStartDistance = Mathf.Lerp(startLinearStart, endLinearStart, t);
RenderSettings.fogEndDistance = Mathf.Lerp(startLinearEnd, endLinearEnd, t);
elapsed += Time.deltaTime;
yield return null;
}
RenderSettings.fogColor = endColor;
RenderSettings.fogDensity = endDensity;
RenderSettings.fogStartDistance = endLinearStart;
RenderSettings.fogEndDistance = endLinearEnd;
if (!toZoneSettings && FogDefaultSettings.Instance != null)
{
RenderSettings.fogMode = FogDefaultSettings.Instance.fogMode;
RenderSettings.fog = FogDefaultSettings.Instance.fogEnabled;
}
s_transitionCoroutine = null;
s_coroutineRunner = null;
}
// --- LOGIKA TYLKO DLA EDYTORA UNITY ---
#if UNITY_EDITOR
private static bool s_editorSettingsSaved = false;
private static FogZone s_editorActiveZone = null;
private static bool s_prevFogEnabled;
private static Color s_prevFogColor;
private static FogMode s_prevFogMode;
private static float s_prevFogDensity;
private static float s_prevFogStartDist;
private static float s_prevFogEndDist;
private void OnEnable()
{
var col = GetComponent<Collider>();
if (col != null) col.isTrigger = true;
if (!Application.isPlaying)
{
EditorApplication.update += EditorUpdate;
}
}
private void OnDisable()
{
if (!Application.isPlaying)
{
EditorApplication.update -= EditorUpdate;
if (s_editorActiveZone == this)
{
RestoreEditorSettings();
s_editorActiveZone = null;
}
}
}
@@ -78,217 +196,90 @@ public class URPFogZone_Master : MonoBehaviour
{
if (Application.isPlaying) return;
// *** POPRAWKA JEST TUTAJ ***
// Jeœli podgl¹d jest wy³¹czony, ale ta strefa jest wci¹¿ aktywna, przywróæ ustawienia
if (!enableEditorPreview)
{
if (s_editorActiveZone == this)
{
RestoreEditorSettings();
s_editorActiveZone = null;
}
return; // Zakoñcz dzia³anie metody, jeœli podgl¹d jest wy³¹czony
}
var sceneView = SceneView.lastActiveSceneView;
if (sceneView == null || sceneView.camera == null) return;
if (zoneCollider == null) zoneCollider = GetComponent<Collider>();
var zoneCollider = GetComponent<Collider>();
if (zoneCollider == null) return;
bool isCurrentlyInside = zoneCollider.bounds.Contains(sceneView.camera.transform.position);
bool isCameraInside = zoneCollider.bounds.Contains(sceneView.camera.transform.position);
if (isCurrentlyInside && s_activeZone != this)
if (isCameraInside)
{
s_activeZone = this;
SaveDefaultFogSettings();
ApplyTargetSettingsDirectly();
if (s_editorActiveZone != this)
{
if (s_editorActiveZone == null)
{
SaveEditorSettings();
}
s_editorActiveZone = this;
ApplyZoneSettingsDirectly();
}
}
else if (!isCurrentlyInside && s_activeZone == this)
else
{
s_activeZone = null;
RestoreDefaultSettings();
}
}
#endif
#endregion
#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);
}
private void OnTriggerExit(Collider other)
{
if (!Application.isPlaying || !other.CompareTag(triggerTag)) return;
if (s_activeZone == this)
{
s_activeZone = null;
StartTransition(false);
}
}
#endregion
// =================================================================================
#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);
if (s_editorActiveZone == this)
{
RestoreEditorSettings();
s_editorActiveZone = null;
}
}
}
#endregion
// =================================================================================
#region Metody G³ówne
private static void SaveDefaultFogSettings()
private void OnValidate()
{
if (s_defaultsSaved) return;
s_defaultFogEnabled = RenderSettings.fog;
s_defaultFogColor = RenderSettings.fogColor;
s_defaultFogMode = RenderSettings.fogMode;
s_defaultFogDensity = RenderSettings.fogDensity;
s_defaultFogStartDistance = RenderSettings.fogStartDistance;
s_defaultFogEndDistance = RenderSettings.fogEndDistance;
s_defaultsSaved = true;
if (!Application.isPlaying && s_editorActiveZone == this)
{
ApplyZoneSettingsDirectly();
}
}
private static void RestoreDefaultSettings()
private static void SaveEditorSettings()
{
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
if (s_editorSettingsSaved) return;
s_prevFogEnabled = RenderSettings.fog;
s_prevFogColor = RenderSettings.fogColor;
s_prevFogMode = RenderSettings.fogMode;
s_prevFogDensity = RenderSettings.fogDensity;
s_prevFogStartDist = RenderSettings.fogStartDistance;
s_prevFogEndDist = RenderSettings.fogEndDistance;
s_editorSettingsSaved = true;
}
private void ApplyTargetSettingsDirectly()
private void ApplyZoneSettingsDirectly()
{
RenderSettings.fog = targetFogEnabled;
RenderSettings.fog = true;
RenderSettings.fogMode = targetFogMode;
RenderSettings.fogColor = targetFogColor;
RenderSettings.fogDensity = targetFogDensity;
RenderSettings.fogStartDistance = targetFogStartDistance;
RenderSettings.fogEndDistance = targetFogEndDistance;
#if UNITY_EDITOR
SceneView.RepaintAll();
}
private static void RestoreEditorSettings()
{
if (!s_editorSettingsSaved) return;
RenderSettings.fog = s_prevFogEnabled;
RenderSettings.fogColor = s_prevFogColor;
RenderSettings.fogMode = s_prevFogMode;
RenderSettings.fogDensity = s_prevFogDensity;
RenderSettings.fogStartDistance = s_prevFogStartDist;
RenderSettings.fogEndDistance = s_prevFogEndDist;
s_editorSettingsSaved = false;
SceneView.RepaintAll();
}
#endif
}
private void StartTransition(bool toTarget)
{
if (transitionCoroutine != null)
{
StopCoroutine(transitionCoroutine);
}
transitionCoroutine = StartCoroutine(TransitionFogCoroutine(toTarget));
}
private IEnumerator TransitionFogCoroutine(bool toTarget)
{
float elapsed = 0f;
Color startColor = RenderSettings.fogColor;
float startDensity = RenderSettings.fogDensity;
float startStartDist = RenderSettings.fogStartDistance;
float startEndDist = RenderSettings.fogEndDistance;
Color finalColor = toTarget ? targetFogColor : s_defaultFogColor;
float finalDensity = toTarget ? targetFogDensity : s_defaultFogDensity;
float finalStartDist = toTarget ? targetFogStartDistance : s_defaultFogStartDistance;
float finalEndDist = toTarget ? targetFogEndDistance : s_defaultFogEndDistance;
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)
{
// 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
}

View File

@@ -62,7 +62,7 @@ Material:
- _near: 0
m_Colors:
- _CameraFadeDistances: {r: 1, g: 0.5, b: 1, a: 3}
- _Color: {r: 0.1762193, g: 0.20063888, b: 0.2264151, a: 0.62352943}
- _Color: {r: 0.13171947, g: 0.14059207, b: 0.1509434, a: 0.62352943}
- _DetailScrollSpeed: {r: 0, g: 1, b: 2, a: 0.3}
- _SceneFadeDistances: {r: 0.36, g: 2.7027028, b: 0.36, a: 0.73}
m_BuildTextureStacks: []