diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 8983121..e8e2a68 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -2,7 +2,9 @@ "permissions": { "allow": [ "WebSearch", - "WebFetch(domain:docs.unity3d.com)" + "WebFetch(domain:docs.unity3d.com)", + "Bash(grep -l \"3009578ee03d9ed46a97978c08168eee\" \"c:/Users/jze9/Documents/unity/my-project/Assets/Blocks/texturs/\"*.meta)", + "Bash(grep -l \"640e614afcdf0cc42ae02e2b478ae512\" \"c:/Users/jze9/Documents/unity/my-project/Assets/Blocks/texturs/\"*.meta)" ] } } diff --git a/Assets/Blocks/Blok.obj b/Assets/Blocks/Blok.obj new file mode 100644 index 0000000..7d9eb0d --- /dev/null +++ b/Assets/Blocks/Blok.obj @@ -0,0 +1,50 @@ +# Blender 5.1.1 +# www.blender.org +mtllib Blok.mtl +o Cube +v 1.000000 1.000000 -1.000000 +v 1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +v -1.000000 -1.000000 -1.000000 +v -1.000000 1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +vn -0.0000 1.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -1.0000 -0.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vt 0.498423 0.501818 +vt 0.498423 0.998602 +vt 0.001023 0.998602 +vt 0.001023 0.501818 +vt 0.999046 0.500959 +vt 0.999046 0.999078 +vt 0.500927 0.999078 +vt 0.500927 0.500959 +vt 0.999042 0.500940 +vt 0.999042 0.999059 +vt 0.500923 0.999059 +vt 0.500923 0.500940 +vt 0.498289 0.001223 +vt 0.498289 0.499608 +vt 0.001369 0.499608 +vt 0.001369 0.001223 +vt 0.999051 0.500945 +vt 0.999051 0.999064 +vt 0.500931 0.999064 +vt 0.500931 0.500944 +vt 0.999044 0.500954 +vt 0.999043 0.999074 +vt 0.500924 0.999074 +vt 0.500924 0.500954 +s 0 +usemtl Material0 +f 1/1/1 5/2/1 7/3/1 3/4/1 +f 4/5/2 3/6/2 7/7/2 8/8/2 +f 8/9/3 7/10/3 5/11/3 6/12/3 +f 6/13/4 2/14/4 4/15/4 8/16/4 +f 2/17/5 1/18/5 3/19/5 4/20/5 +f 6/21/6 5/22/6 1/23/6 2/24/6 diff --git a/Assets/Blocks/Blok.obj.meta b/Assets/Blocks/Blok.obj.meta new file mode 100644 index 0000000..62c48b6 --- /dev/null +++ b/Assets/Blocks/Blok.obj.meta @@ -0,0 +1,110 @@ +fileFormatVersion: 2 +guid: 9491bc8c1f13b6541bb223ae6d55788a +ModelImporter: + serializedVersion: 24200 + 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: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + 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 + generateMeshLods: 0 + meshLodGenerationFlags: 0 + maximumMeshLod: -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: diff --git a/Assets/Items/ferstitem.prefab.meta b/Assets/Blocks/Definitions.meta similarity index 57% rename from Assets/Items/ferstitem.prefab.meta rename to Assets/Blocks/Definitions.meta index 4d6ff76..b1d2f48 100644 --- a/Assets/Items/ferstitem.prefab.meta +++ b/Assets/Blocks/Definitions.meta @@ -1,6 +1,7 @@ fileFormatVersion: 2 -guid: 06e51a4df39df524397e91edba2a833d -PrefabImporter: +guid: 2caa39746acdf3e449c6ffe7b49194b0 +folderAsset: yes +DefaultImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Blocks/Definitions/tree.asset b/Assets/Blocks/Definitions/tree.asset new file mode 100644 index 0000000..2039d77 --- /dev/null +++ b/Assets/Blocks/Definitions/tree.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !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: 0c5e75bc3cec52e44bb5bcb6687e6237, type: 3} + m_Name: tree + m_EditorClassIdentifier: Assembly-CSharp::BlockDefinition + blockId: 1 + displayName: tree + topTexture: {fileID: 2800000, guid: 31d7c3b267ede19409f90e3eed1c1266, type: 3} + bottomTexture: {fileID: 2800000, guid: 31d7c3b267ede19409f90e3eed1c1266, type: 3} + sideTexture: {fileID: 2800000, guid: 31d7c3b267ede19409f90e3eed1c1266, type: 3} + linkedItem: {fileID: 11400000, guid: 131ca9b5c83edfe4d9c35a6ef4a380a5, type: 2} + isSolid: 1 + topIndex: 0 + bottomIndex: 1 + sideIndex: 2 diff --git a/Assets/Inventory/Items/ferstitem123.asset.meta b/Assets/Blocks/Definitions/tree.asset.meta similarity index 79% rename from Assets/Inventory/Items/ferstitem123.asset.meta rename to Assets/Blocks/Definitions/tree.asset.meta index b93667b..16cc144 100644 --- a/Assets/Inventory/Items/ferstitem123.asset.meta +++ b/Assets/Blocks/Definitions/tree.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5db581fdeb06daf4da37cb3d6f32b5ff +guid: f827f1cb7a209854598b7f1ee52d32e4 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Blocks/Scripts/BlockDefinition.cs b/Assets/Blocks/Scripts/BlockDefinition.cs index 879d5cb..4718e87 100644 --- a/Assets/Blocks/Scripts/BlockDefinition.cs +++ b/Assets/Blocks/Scripts/BlockDefinition.cs @@ -11,10 +11,10 @@ public class BlockDefinition : ScriptableObject public string blockId; // уникальный ID, например "grass", "dirt" public string displayName; - [Header("Textures (128×128)")] - public Texture2D topTexture; // грань Y+ - public Texture2D bottomTexture; // грань Y- - public Texture2D sideTexture; // все 4 боковых грани + [Header("Textures (Sprite или Texture2D)")] + public Sprite topTexture; // грань Y+ + public Sprite bottomTexture; // грань Y- + public Sprite sideTexture; // все 4 боковых грани [Header("Inventory Link")] [Tooltip("ItemData с типом Block, связанная с этим блоком")] diff --git a/Assets/Blocks/Scripts/BlockPlacer.cs b/Assets/Blocks/Scripts/BlockPlacer.cs index 75a6569..73ec399 100644 --- a/Assets/Blocks/Scripts/BlockPlacer.cs +++ b/Assets/Blocks/Scripts/BlockPlacer.cs @@ -17,11 +17,12 @@ public class BlockPlacer : MonoBehaviour public Texture2D crackTexture; // текстура трещин (grayscale) // ── Приватное ───────────────────────────────────────────────────────────── - Camera _cam; - float _breakProgress; - Vector3Int _breakingBlock = Vector3Int.one * int.MinValue; // "никакой" - GameObject _breakOverlay; - MeshRenderer _overlayRenderer; + Camera _cam; + float _breakProgress; + Vector3Int _breakingBlock = Vector3Int.one * int.MinValue; + GameObject _breakOverlay; + MeshRenderer _overlayRenderer; + MaterialPropertyBlock _mpb; static readonly int PropProgress = Shader.PropertyToID("_Progress"); @@ -49,7 +50,7 @@ public class BlockPlacer : MonoBehaviour void HandleBreak() { - if (!Input.GetMouseButton(0)) + if (PlayerInput.Instance == null || !PlayerInput.Instance.BreakHeld) { CancelBreak(); return; @@ -61,6 +62,7 @@ public class BlockPlacer : MonoBehaviour return; } + // Сменился ли целевой блок? if (blockPos != _breakingBlock) { @@ -106,7 +108,7 @@ public class BlockPlacer : MonoBehaviour void HandlePlace() { - if (!Input.GetMouseButtonDown(1)) return; + if (PlayerInput.Instance == null || !PlayerInput.Instance.PlacePressed) return; if (!Raycast(out RaycastHit hit, out Vector3Int blockPos)) return; // Ячейка, куда ставим = сосед грани которую мы смотрим @@ -120,11 +122,7 @@ public class BlockPlacer : MonoBehaviour if (selectedItem == null) return; var def = BlockRegistry.Instance?.GetByItemId(selectedItem.id); - if (def == null) - { - Debug.Log($"[BlockPlacer] {selectedItem.itemName} не является блоком."); - return; - } + if (def == null) return; WorldManager.Instance.PlaceBlock(placePos, def.blockId); @@ -154,11 +152,10 @@ public class BlockPlacer : MonoBehaviour void UpdateOverlay(float progress) { if (_overlayRenderer == null) return; - // MaterialPropertyBlock — не создаём новый экземпляр материала - var mpb = new MaterialPropertyBlock(); - _overlayRenderer.GetPropertyBlock(mpb); - mpb.SetFloat(PropProgress, progress); - _overlayRenderer.SetPropertyBlock(mpb); + _mpb ??= new MaterialPropertyBlock(); + _overlayRenderer.GetPropertyBlock(_mpb); + _mpb.SetFloat(PropProgress, progress); + _overlayRenderer.SetPropertyBlock(_mpb); } // ── Утилиты ─────────────────────────────────────────────────────────────── @@ -166,9 +163,13 @@ public class BlockPlacer : MonoBehaviour bool Raycast(out RaycastHit hit, out Vector3Int blockPos) { blockPos = default; - Ray ray = new Ray(_cam.transform.position, _cam.transform.forward); + Ray ray = new Ray(_cam.transform.position, _cam.transform.forward); - if (Physics.Raycast(ray, out hit, reach, blockLayer)) + // blockLayer == 0 означает "Nothing" в Unity LayerMask — рейкаст ни по чему не попадёт. + // Если слой не назначен в Inspector, бьём по всем слоям (-1 = Everything). + int mask = blockLayer.value == 0 ? ~0 : blockLayer.value; + + if (Physics.Raycast(ray, out hit, reach, mask)) { // hit.point лежит на грани — смещаемся чуть внутрь блока Vector3 inner = hit.point - hit.normal * 0.01f; diff --git a/Assets/Blocks/Scripts/BlockRegistry.cs b/Assets/Blocks/Scripts/BlockRegistry.cs index 5713e18..ca87fc9 100644 --- a/Assets/Blocks/Scripts/BlockRegistry.cs +++ b/Assets/Blocks/Scripts/BlockRegistry.cs @@ -45,7 +45,14 @@ public class BlockRegistry : MonoBehaviour // Собираем уникальные текстуры (top/bottom/side каждого блока) // Порядок: для блока i → top=i*3, bottom=i*3+1, side=i*3+2 int layerCount = definitions.Count * 3; - int res = 128; // разрешение должно совпадать с текстурами блоков + + // Авто-определяем разрешение по первой найденной текстуре (берём из rect спрайта) + int res = 16; + foreach (var d in definitions) + { + Sprite s = d.topTexture ?? d.sideTexture ?? d.bottomTexture; + if (s != null) { res = (int)s.rect.width; break; } + } TexArray = new Texture2DArray(res, res, layerCount, TextureFormat.RGBA32, true, false); @@ -100,40 +107,43 @@ public class BlockRegistry : MonoBehaviour // ── Утилиты ─────────────────────────────────────────────────────────────── /// - /// Копирует пиксели из src в Texture2DArray на слой layerIndex. - /// Если src null или не того размера — заполняет пурпурным (ошибка-текстура). + /// Копирует один спрайт (или его часть из атласа) в слой Texture2DArray. + /// Использует Graphics.Blit с UV offset/scale — Read/Write не нужен. + /// Если src null — заполняет пурпурным (ошибка-текстура). /// - static void CopyTexture(Texture2D src, Texture2DArray dst, int layerIndex, int res) + static void CopyTexture(Sprite src, Texture2DArray dst, int layerIndex, int res) { - Color[] pixels; - if (src == null) { - // Пурпурный = "текстура не назначена" - pixels = new Color[res * res]; + var pixels = new Color[res * res]; for (int p = 0; p < pixels.Length; p++) pixels[p] = (p / res + p) % 2 == 0 ? Color.magenta : Color.black; - } - else if (src.width != res || src.height != res) - { - Debug.LogWarning($"[BlockRegistry] {src.name} is {src.width}×{src.height}, expected {res}×{res}. Scaling."); - // Простой fallback — масштабировать через RenderTexture - var rt = RenderTexture.GetTemporary(res, res); - Graphics.Blit(src, rt); - var prev = RenderTexture.active; - RenderTexture.active = rt; - var resized = new Texture2D(res, res, TextureFormat.RGBA32, false); - resized.ReadPixels(new Rect(0, 0, res, res), 0, 0); - resized.Apply(); - RenderTexture.active = prev; - RenderTexture.ReleaseTemporary(rt); - pixels = resized.GetPixels(); - } - else - { - pixels = src.GetPixels(); + dst.SetPixels(pixels, layerIndex); + return; } - dst.SetPixels(pixels, layerIndex); + // Вычисляем UV offset/scale этого спрайта внутри атласа. + // sprite.rect — пиксельные координаты (origin = bottom-left атласа). + float atlasW = src.texture.width; + float atlasH = src.texture.height; + var scale = new Vector2(src.rect.width / atlasW, src.rect.height / atlasH); + var offset = new Vector2(src.rect.x / atlasW, src.rect.y / atlasH); + + var rt = RenderTexture.GetTemporary(res, res, 0, RenderTextureFormat.ARGB32); + var prevFilter = src.texture.filterMode; + src.texture.filterMode = FilterMode.Point; + Graphics.Blit(src.texture, rt, scale, offset); + src.texture.filterMode = prevFilter; + + var prev = RenderTexture.active; + RenderTexture.active = rt; + var tmp = new Texture2D(res, res, TextureFormat.RGBA32, false); + tmp.ReadPixels(new Rect(0, 0, res, res), 0, 0); + tmp.Apply(); + RenderTexture.active = prev; + RenderTexture.ReleaseTemporary(rt); + + dst.SetPixels(tmp.GetPixels(), layerIndex); + Object.Destroy(tmp); } } diff --git a/Assets/Blocks/Scripts/Chunk.cs b/Assets/Blocks/Scripts/Chunk.cs index 88fe11a..2968fd1 100644 --- a/Assets/Blocks/Scripts/Chunk.cs +++ b/Assets/Blocks/Scripts/Chunk.cs @@ -30,18 +30,18 @@ public class Chunk : MonoBehaviour // Порядок по часовой стрелке, смотрим снаружи static readonly Vector3[][] FaceVerts = { - // Top (Y+) + // Top (Y+) — нормаль (0,+1,0) ✓ new[] { new Vector3(0,1,0), new Vector3(0,1,1), new Vector3(1,1,1), new Vector3(1,1,0) }, - // Bottom (Y-) + // Bottom (Y-) — нормаль (0,-1,0) ✓ new[] { new Vector3(0,0,0), new Vector3(1,0,0), new Vector3(1,0,1), new Vector3(0,0,1) }, - // Front (Z+) - new[] { new Vector3(1,0,1), new Vector3(0,0,1), new Vector3(0,1,1), new Vector3(1,1,1) }, - // Back (Z-) - new[] { new Vector3(0,0,0), new Vector3(1,0,0), new Vector3(1,1,0), new Vector3(0,1,0) }, - // Right (X+) - new[] { new Vector3(1,0,0), new Vector3(1,0,1), new Vector3(1,1,1), new Vector3(1,1,0) }, - // Left (X-) - new[] { new Vector3(0,0,1), new Vector3(0,0,0), new Vector3(0,1,0), new Vector3(0,1,1) } + // Front (Z+) — нормаль (0,0,+1), исправлен порядок вершин + new[] { new Vector3(0,0,1), new Vector3(1,0,1), new Vector3(1,1,1), new Vector3(0,1,1) }, + // Back (Z-) — нормаль (0,0,-1), исправлен порядок вершин + new[] { new Vector3(1,0,0), new Vector3(0,0,0), new Vector3(0,1,0), new Vector3(1,1,0) }, + // Right (X+) — нормаль (+1,0,0), исправлен порядок вершин + new[] { new Vector3(1,0,1), new Vector3(1,0,0), new Vector3(1,1,0), new Vector3(1,1,1) }, + // Left (X-) — нормаль (-1,0,0), исправлен порядок вершин + new[] { new Vector3(0,0,0), new Vector3(0,0,1), new Vector3(0,1,1), new Vector3(0,1,0) } }; // UV для каждой из 4 вершин грани @@ -63,11 +63,11 @@ public class Chunk : MonoBehaviour _filter.sharedMesh = _mesh; } - public void Initialise(ChunkData data, Material chunkMaterial) + public void Initialise(ChunkData data, Material chunkMaterial, bool buildMesh = true) { Data = data; _renderer.sharedMaterial = chunkMaterial; - RebuildMesh(); + if (buildMesh) RebuildMesh(); } // ── Публичный API ───────────────────────────────────────────────────────── @@ -92,10 +92,10 @@ public class Chunk : MonoBehaviour { if (Data == null) return; - var verts = new List(); - var tris = new List(); - var uvs = new List(); // UV0: координаты на грани 0-1 - var texCoord1 = new List(); // UV1: x = индекс в Texture2DArray + var verts = new List(); + var tris = new List(); + var uvs = new List(); // UV0: координаты на грани 0-1 + var texCoord1 = new List(); // UV1: x = texIndex, y = face brightness for (int x = 0; x < ChunkData.SIZE; x++) for (int y = 0; y < ChunkData.HEIGHT; y++) @@ -114,19 +114,23 @@ public class Chunk : MonoBehaviour // Face culling: пропускаем грань если сосед — твёрдый блок if (HasSolidNeighbour(neighbour)) continue; - // Индекс текстуры для этой грани - int texIndex = f == 0 ? def.topIndex : - f == 1 ? def.bottomIndex : - def.sideIndex; + // Индекс текстуры и яркость грани (Minecraft-стиль) + int texIndex = f == 0 ? def.topIndex : + f == 1 ? def.bottomIndex : + def.sideIndex; + float bright = f == 0 ? 1.0f : // top + f == 1 ? 0.5f : // bottom + 0.8f; // sides int baseVert = verts.Count; var origin = new Vector3(x, y, z); + var faceUV = new Vector2(texIndex, bright); // одна аллокация на грань, не на вершину for (int v = 0; v < 4; v++) { verts.Add(origin + FaceVerts[f][v]); uvs.Add(FaceUVs[v]); - texCoord1.Add(new Vector2(texIndex, 0)); + texCoord1.Add(faceUV); } // Два треугольника на грань diff --git a/Assets/Blocks/Scripts/FlatWorldGenerator.cs b/Assets/Blocks/Scripts/FlatWorldGenerator.cs index f76a2b8..10e069a 100644 --- a/Assets/Blocks/Scripts/FlatWorldGenerator.cs +++ b/Assets/Blocks/Scripts/FlatWorldGenerator.cs @@ -53,6 +53,10 @@ public class FlatWorldGenerator : MonoBehaviour WorldManager.Instance.CreateChunk(chunkPos, data); } + // Перестраиваем все меши после создания всех чанков — + // иначе граничные грани между соседними чанками не скрываются + WorldManager.Instance.RebuildAllChunks(); + Debug.Log($"[FlatWorldGenerator] Generated {chunksX * chunksZ} chunks."); } diff --git a/Assets/Blocks/Scripts/WorldManager.cs b/Assets/Blocks/Scripts/WorldManager.cs index bfb7bb4..3f0b40d 100644 --- a/Assets/Blocks/Scripts/WorldManager.cs +++ b/Assets/Blocks/Scripts/WorldManager.cs @@ -16,6 +16,10 @@ public class WorldManager : MonoBehaviour [Tooltip("Можно оставить пустым — создаётся из кода")] public GameObject chunkPrefab; + [Header("Chunk Layer")] + [Tooltip("Слой для всех чанков — должен совпадать с blockLayer в BlockPlacer")] + public LayerMask chunkLayer; + // chunkPos (в чанковых координатах) → Chunk private readonly Dictionary _chunks = new(); @@ -97,8 +101,11 @@ public class WorldManager : MonoBehaviour go.transform.position = ChunkData.ChunkToWorld(chunkPos); + if (chunkLayer.value != 0) + go.layer = Mathf.RoundToInt(Mathf.Log(chunkLayer.value, 2)); + var chunk = go.GetComponent() ?? go.AddComponent(); - chunk.Initialise(data, registry.ChunkMaterial); + chunk.Initialise(data, registry.ChunkMaterial, buildMesh: false); _chunks[chunkPos] = chunk; return chunk; @@ -129,6 +136,16 @@ public class WorldManager : MonoBehaviour chunk.RebuildMesh(); } + /// + /// Перестраивает меши всех чанков. + /// Вызывать после того как все чанки созданы — исправляет граничные грани. + /// + public void RebuildAllChunks() + { + foreach (var chunk in _chunks.Values) + chunk.RebuildMesh(); + } + /// Перевод мировой позиции игрока → мировые координаты блока. public static Vector3Int WorldToBlock(Vector3 worldPosition) { diff --git a/Assets/Blocks/Shaders/VoxelLit.shader b/Assets/Blocks/Shaders/VoxelLit.shader index 55ba99f..9c20fd5 100644 --- a/Assets/Blocks/Shaders/VoxelLit.shader +++ b/Assets/Blocks/Shaders/VoxelLit.shader @@ -3,53 +3,108 @@ Shader "Blocks/VoxelLit" Properties { _MainTexArray ("Texture Array", 2DArray) = "" {} - _Glossiness ("Smoothness", Range(0,1)) = 0.0 - _Metallic ("Metallic", Range(0,1)) = 0.0 } SubShader { Tags { "RenderType"="Opaque" } - LOD 200 + LOD 100 + Cull Off // рендерим обе стороны граней — нужно для видимости стен внутри ям - CGPROGRAM - // Standard surface shader с кастомным vertex для передачи texIndex - #pragma surface surf Standard fullforwardshadows vertex:vert - #pragma target 3.5 - #pragma require 2darray - - UNITY_DECLARE_TEX2DARRAY(_MainTexArray); - - struct Input + Pass { - float2 uv_MainTexArray; // стандартный UV (0-1 по грани) - float texIndex; // индекс слоя в Texture2DArray - }; + Tags { "LightMode"="ForwardBase" } - half _Glossiness; - half _Metallic; + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_fog + #pragma multi_compile_fwdbase + #pragma target 3.5 + #pragma require 2darray - // Vertex-функция: читаем texIndex из канала UV1 (mesh.uv2) - void vert(inout appdata_full v, out Input o) - { - UNITY_INITIALIZE_OUTPUT(Input, o); - o.uv_MainTexArray = v.texcoord.xy; - o.texIndex = v.texcoord1.x; // UV1.x = индекс текстуры + #include "UnityCG.cginc" + #include "AutoLight.cginc" + + UNITY_DECLARE_TEX2DARRAY(_MainTexArray); + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; // UV грани 0-1 + float2 uv2 : TEXCOORD1; // x = texIndex, y = face brightness + }; + + struct v2f + { + float4 pos : SV_POSITION; + float3 uvTex : TEXCOORD0; // xy = UV, z = texIndex + float bright : TEXCOORD1; // face brightness (0.5 – 1.0) + UNITY_FOG_COORDS(2) + SHADOW_COORDS(3) + }; + + v2f vert(appdata v) + { + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); + o.uvTex = float3(v.uv, v.uv2.x); + o.bright = v.uv2.y; + UNITY_TRANSFER_FOG(o, o.pos); + TRANSFER_SHADOW(o); + return o; + } + + fixed4 frag(v2f i) : SV_Target + { + fixed4 col = UNITY_SAMPLE_TEX2DARRAY(_MainTexArray, i.uvTex); + + // Minecraft-стиль освещения: фиксированная яркость по направлению грани + col.rgb *= i.bright; + + // Тени от directional light + fixed shadow = SHADOW_ATTENUATION(i); + col.rgb *= lerp(0.5, 1.0, shadow); + + UNITY_APPLY_FOG(i.fogCoord, col); + return col; + } + ENDCG } - void surf(Input IN, inout SurfaceOutputStandard o) + // Shadow caster pass — нужен чтобы чанки отбрасывали тени + Pass { - fixed4 c = UNITY_SAMPLE_TEX2DARRAY( - _MainTexArray, - float3(IN.uv_MainTexArray, IN.texIndex) - ); - o.Albedo = c.rgb; - o.Metallic = _Metallic; - o.Smoothness = _Glossiness; - o.Alpha = c.a; + Tags { "LightMode"="ShadowCaster" } + Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #pragma target 3.5 + + #include "UnityCG.cginc" + + struct appdata { float4 vertex : POSITION; }; + + struct v2f + { + V2F_SHADOW_CASTER; + }; + + v2f vert(appdata v) + { + v2f o; + TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) + return o; + } + + fixed4 frag(v2f i) : SV_Target + { + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG } - ENDCG } - - FallBack "Diffuse" } diff --git a/Assets/Blocks/material.meta b/Assets/Blocks/material.meta new file mode 100644 index 0000000..5520a10 --- /dev/null +++ b/Assets/Blocks/material.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75b00cdc4ce553b4087844bae1e992e2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/material/tree.mat b/Assets/Blocks/material/tree.mat new file mode 100644 index 0000000..be25014 --- /dev/null +++ b/Assets/Blocks/material/tree.mat @@ -0,0 +1,95 @@ +%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: tree + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _GLOSSYREFLECTIONS_OFF + - _SPECULARHIGHLIGHTS_OFF + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: _Metallic _MetallicGlossMap + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _CrackTex: + 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: 0} + 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} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 31d7c3b267ede19409f90e3eed1c1266, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTexArray: + 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} + - _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} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Progress: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Inventory/Items/ferstitem.asset.meta b/Assets/Blocks/material/tree.mat.meta similarity index 64% rename from Assets/Inventory/Items/ferstitem.asset.meta rename to Assets/Blocks/material/tree.mat.meta index f87cae9..c476e1c 100644 --- a/Assets/Inventory/Items/ferstitem.asset.meta +++ b/Assets/Blocks/material/tree.mat.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: d870f627519521f4aa24b9a36766465d +guid: 2a59d3fb9416740458f1398cf6b2f942 NativeFormatImporter: externalObjects: {} - mainObjectFileID: 11400000 + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Blocks/texturs.meta b/Assets/Blocks/texturs.meta new file mode 100644 index 0000000..a569cbe --- /dev/null +++ b/Assets/Blocks/texturs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ef13a612315aeae43bc2d2c363286de6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/texturs/tree.png b/Assets/Blocks/texturs/tree.png new file mode 100644 index 0000000..619bea4 Binary files /dev/null and b/Assets/Blocks/texturs/tree.png differ diff --git a/Assets/Blocks/texturs/tree.png.meta b/Assets/Blocks/texturs/tree.png.meta new file mode 100644 index 0000000..67f8dde --- /dev/null +++ b/Assets/Blocks/texturs/tree.png.meta @@ -0,0 +1,204 @@ +fileFormatVersion: 2 +guid: 31d7c3b267ede19409f90e3eed1c1266 +TextureImporter: + internalIDToNameTable: [] + 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: 2 + spriteExtrude: 1 + spriteMeshType: 0 + 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 + spriteTessellationDetail: -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: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 1 + textureFormat: 12 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + 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: tree_0 + rect: + serializedVersion: 2 + x: 0 + y: 16 + width: 16 + height: 16 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: dca6d7bc05d6ee343bc521837ba8af3f + internalID: -1348885527 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: tree_1 + rect: + serializedVersion: 2 + x: 16 + y: 16 + width: 16 + height: 16 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: be4147745dc24b44d8eb775803676697 + internalID: 394011459 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: tree_2 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 16 + height: 16 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + customData: + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 84a8f42573bda534a9ca4a34894e22dc + internalID: -1937943187 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: b332cdd6f7af3b042972045431002e42 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: + - key: SpriteEditor.SliceSettings + value: '{"sliceOnImport":false,"gridCellCount":{"x":1.0,"y":1.0},"gridSpriteSize":{"x":64.0,"y":64.0},"gridSpriteOffset":{"x":0.0,"y":0.0},"gridSpritePadding":{"x":0.0,"y":0.0},"pivot":{"x":0.5,"y":0.5},"pivotPixels":{"x":0.0,"y":0.0},"autoSlicingMethod":0,"spriteAlignment":0,"pivotUnitMode":0,"slicingType":0,"keepEmptyRects":false,"isAlternate":false}' + - key: SpriteEditor.SliceOnImport + value: False + nameFileIdTable: + tree_0: -1348885527 + tree_1: 394011459 + tree_2: -1937943187 + tree_3: -413478633 + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/texturs/tree1.png b/Assets/Blocks/texturs/tree1.png new file mode 100644 index 0000000..836fb0a Binary files /dev/null and b/Assets/Blocks/texturs/tree1.png differ diff --git a/Assets/Blocks/texturs/tree1.png.meta b/Assets/Blocks/texturs/tree1.png.meta new file mode 100644 index 0000000..56e7f6b --- /dev/null +++ b/Assets/Blocks/texturs/tree1.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 3009578ee03d9ed46a97978c08168eee +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + 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: 32 + resizeAlgorithm: 1 + textureFormat: -1 + textureCompression: 3 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 1 + textureFormat: 10 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + 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: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/texturs/tree2.png b/Assets/Blocks/texturs/tree2.png new file mode 100644 index 0000000..b5ec82b Binary files /dev/null and b/Assets/Blocks/texturs/tree2.png differ diff --git a/Assets/Blocks/texturs/tree2.png.meta b/Assets/Blocks/texturs/tree2.png.meta new file mode 100644 index 0000000..b23d947 --- /dev/null +++ b/Assets/Blocks/texturs/tree2.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 640e614afcdf0cc42ae02e2b478ae512 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + 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: 32 + resizeAlgorithm: 1 + textureFormat: -1 + textureCompression: 3 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 1 + textureFormat: 10 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + 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: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/texturs/tree_icon.PNG b/Assets/Blocks/texturs/tree_icon.PNG new file mode 100644 index 0000000..93af55b Binary files /dev/null and b/Assets/Blocks/texturs/tree_icon.PNG differ diff --git a/Assets/Blocks/texturs/tree_icon.PNG.meta b/Assets/Blocks/texturs/tree_icon.PNG.meta new file mode 100644 index 0000000..25a8b61 --- /dev/null +++ b/Assets/Blocks/texturs/tree_icon.PNG.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 63b56781d36f85e49923a6b7b50381e7 +TextureImporter: + internalIDToNameTable: [] + 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: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 0 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -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: 128 + resizeAlgorithm: 1 + 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: 128 + resizeAlgorithm: 1 + textureFormat: 12 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 1 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + 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: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Blocks/tree.prefab b/Assets/Blocks/tree.prefab new file mode 100644 index 0000000..256d2b8 --- /dev/null +++ b/Assets/Blocks/tree.prefab @@ -0,0 +1,124 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &1834211952878912991 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalPosition.x + value: 0.66041523 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalPosition.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalPosition.z + value: 3.3843179 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_CastShadows + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_MotionVectors + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_RayTracingMode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_Materials.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: 2a59d3fb9416740458f1398cf6b2f942, type: 2} + - target: {fileID: -7635826562936255635, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: 'm_Materials.Array.data[1]' + value: + objectReference: {fileID: 2100000, guid: 2a59d3fb9416740458f1398cf6b2f942, type: 2} + - target: {fileID: 919132149155446097, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_Name + value: tree + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_Layer + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 8164078558771037576, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_Layer + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8164078558771037576, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + insertIndex: -1 + addedObject: {fileID: 6307796976124268661} + m_SourcePrefab: {fileID: 100100000, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} +--- !u!1 &1564165088969144462 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 9491bc8c1f13b6541bb223ae6d55788a, type: 3} + m_PrefabInstance: {fileID: 1834211952878912991} + m_PrefabAsset: {fileID: 0} +--- !u!65 &6307796976124268661 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1564165088969144462} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Assets/Items/ferstitem123.prefab.meta b/Assets/Blocks/tree.prefab.meta similarity index 74% rename from Assets/Items/ferstitem123.prefab.meta rename to Assets/Blocks/tree.prefab.meta index dc204c0..8016439 100644 --- a/Assets/Items/ferstitem123.prefab.meta +++ b/Assets/Blocks/tree.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0e4347f1177decb4a8671c25fe736183 +guid: 3ae36dcb84d70194993d12a9f047bb1c PrefabImporter: externalObjects: {} userData: diff --git a/Assets/Inventory/Items/ferstitem.asset b/Assets/Inventory/Items/ferstitem.asset deleted file mode 100644 index 9bf0a57..0000000 --- a/Assets/Inventory/Items/ferstitem.asset +++ /dev/null @@ -1,31 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !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: 5741b63764436354ebad192c9b71f06c, type: 3} - m_Name: ferstitem - m_EditorClassIdentifier: Assembly-CSharp::ItemData - id: c3b1d462-dc84-4d7a-8463-34ffbde783d9 - itemName: ferstitem - description: ferstitem - type: 5 - modelPrefab: {fileID: 282714382156279063, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - icon: {fileID: 21300000, guid: 0115b2d990086ae4cbc31baf7c64e680, type: 3} - maxStack: 64 - isCraftable: 0 - craftingRecipe: - ingredients: [] - amounts: - resultId: - resultAmount: 1 - weight: 1 - value: 1 - isDroppable: 1 - isStackable: 1 diff --git a/Assets/Inventory/Items/ferstitem123.asset b/Assets/Inventory/Items/ferstitem123.asset deleted file mode 100644 index 831f441..0000000 --- a/Assets/Inventory/Items/ferstitem123.asset +++ /dev/null @@ -1,31 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !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: 5741b63764436354ebad192c9b71f06c, type: 3} - m_Name: ferstitem123 - m_EditorClassIdentifier: Assembly-CSharp::ItemData - id: 4b147ba6-462a-4f90-9d00-29089fed390a - itemName: ferstitem123 - description: 123 - type: 5 - modelPrefab: {fileID: 8569222662204961130, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - icon: {fileID: 21300000, guid: 0115b2d990086ae4cbc31baf7c64e680, type: 3} - maxStack: 64 - isCraftable: 0 - craftingRecipe: - ingredients: [] - amounts: - resultId: - resultAmount: 1 - weight: 1 - value: 1 - isDroppable: 1 - isStackable: 1 diff --git a/Assets/Inventory/Items/NewItem.asset b/Assets/Inventory/Items/tree.asset similarity index 67% rename from Assets/Inventory/Items/NewItem.asset rename to Assets/Inventory/Items/tree.asset index 67f6105..a2676b6 100644 --- a/Assets/Inventory/Items/NewItem.asset +++ b/Assets/Inventory/Items/tree.asset @@ -10,14 +10,14 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 5741b63764436354ebad192c9b71f06c, type: 3} - m_Name: newItem + m_Name: tree m_EditorClassIdentifier: Assembly-CSharp::ItemData - id: c58a6ea4-f064-4392-becd-3b4c2b17cd06 - itemName: newItem - description: 123123 - type: 5 - modelPrefab: {fileID: 282714382156279063, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - icon: {fileID: 0} + id: f1f81603-393a-4a74-8c41-a9efe9f14e9e + itemName: tree + description: tree + type: 0 + modelPrefab: {fileID: 2501859741750806132, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + icon: {fileID: 21300000, guid: 63b56781d36f85e49923a6b7b50381e7, type: 3} maxStack: 64 isCraftable: 0 craftingRecipe: diff --git a/Assets/Inventory/Items/NewItem.asset.meta b/Assets/Inventory/Items/tree.asset.meta similarity index 79% rename from Assets/Inventory/Items/NewItem.asset.meta rename to Assets/Inventory/Items/tree.asset.meta index 83ebba2..249adb3 100644 --- a/Assets/Inventory/Items/NewItem.asset.meta +++ b/Assets/Inventory/Items/tree.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 20cff4d8f616b1140b2264c6f049ba8a +guid: 131ca9b5c83edfe4d9c35a6ef4a380a5 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Assets/Inventory/Scripts/CraftingManager.cs b/Assets/Inventory/Scripts/CraftingManager.cs index 25cd50a..2119de4 100644 --- a/Assets/Inventory/Scripts/CraftingManager.cs +++ b/Assets/Inventory/Scripts/CraftingManager.cs @@ -21,9 +21,15 @@ public class CraftingManager : MonoBehaviour void Awake() { if (Instance == null) + { Instance = this; + DontDestroyOnLoad(gameObject); + } else + { Destroy(gameObject); + return; + } _recipeDict = new Dictionary(); foreach (var recipe in recipes) diff --git a/Assets/Inventory/Scripts/InventoryDragDrop.cs b/Assets/Inventory/Scripts/InventoryDragDrop.cs index 675a2eb..ad6ea9d 100644 --- a/Assets/Inventory/Scripts/InventoryDragDrop.cs +++ b/Assets/Inventory/Scripts/InventoryDragDrop.cs @@ -3,86 +3,84 @@ using UnityEngine.EventSystems; using UnityEngine.UI; /// -/// Обработка Drag & Drop предметов между слотами и выброс за пределы инвентаря +/// Drag & Drop предметов между слотами. +/// Один общий DragIconCanvas на все слоты — создаётся при первом старте. /// public class InventoryDragDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler { public Slot slot; public int slotIndex; - [Header("Drag Visual")] - [SerializeField] private RectTransform dragIcon; - [SerializeField] private Image dragImage; - [SerializeField] private float dragIconScale = 1.2f; + [SerializeField] private float dragIconScale = 1.2f; + [SerializeField] private bool allowDropOutside = true; + [SerializeField] private float dropThreshold = 100f; - [Header("Drop Settings")] - [SerializeField] private bool allowDropOutside = true; - [SerializeField] private float dropThreshold = 100f; // пикселей за пределами инвентаря + // ── Общий на все слоты drag-icon ───────────────────────────────────────── + private static GameObject _sharedCanvas; + private static RectTransform _sharedIcon; + private static Image _sharedImage; - private Canvas _canvas; - private CanvasGroup _canvasGroup; - private bool _isDragging; - private Vector2 _dragStartPosition; + // ── Per-instance поля ───────────────────────────────────────────────────── + private CanvasGroup _canvasGroup; + private bool _isDragging; private RectTransform _inventoryPanelRect; + // ── Unity lifecycle ─────────────────────────────────────────────────────── + void Start() { - _canvas = GetComponentInParent(); _canvasGroup = GetComponent(); - if (dragIcon == null) - { - CreateDragIcon(); - } + // Создаём общий DragCanvas один раз для всех слотов + if (_sharedCanvas == null) + CreateSharedDragCanvas(); - // Находим панель инвентаря - var inventoryManager = FindObjectOfType(); - if (inventoryManager?.inventoryPanel != null) - { - _inventoryPanelRect = inventoryManager.inventoryPanel.GetComponent(); - } - - if (dragIcon != null) - dragIcon.gameObject.SetActive(false); + // Ищем rect инвентарной панели для определения «вне панели» + if (InventoryManager.Instance?.inventoryPanel != null) + _inventoryPanelRect = InventoryManager.Instance.inventoryPanel + .GetComponent(); } - private void CreateDragIcon() + private static void CreateSharedDragCanvas() { - GameObject canvasGO = new GameObject("DragIconCanvas"); - canvasGO.transform.SetParent(_canvas != null ? _canvas.transform : transform.root); + _sharedCanvas = new GameObject("DragIconCanvas"); + DontDestroyOnLoad(_sharedCanvas); - var dragCanvas = canvasGO.AddComponent(); - dragCanvas.overrideSorting = true; - dragCanvas.sortingOrder = 1000; - dragCanvas.renderMode = RenderMode.ScreenSpaceOverlay; - canvasGO.AddComponent(); + var c = _sharedCanvas.AddComponent(); + c.renderMode = RenderMode.ScreenSpaceOverlay; + c.sortingOrder = 1000; + c.overrideSorting = true; + _sharedCanvas.AddComponent(); - dragIcon = new GameObject("DragIcon").AddComponent(); - dragIcon.SetParent(canvasGO.transform, false); - dragIcon.sizeDelta = new Vector2(48, 48); + var iconGO = new GameObject("DragIcon"); + iconGO.transform.SetParent(_sharedCanvas.transform, false); - dragImage = dragIcon.gameObject.AddComponent(); - dragImage.raycastTarget = false; + _sharedIcon = iconGO.AddComponent(); + _sharedIcon.sizeDelta = new Vector2(48, 48); - dragIcon.gameObject.SetActive(false); + _sharedImage = iconGO.AddComponent(); + _sharedImage.raycastTarget = false; + + iconGO.SetActive(false); } + // ── Drag handlers ───────────────────────────────────────────────────────── + public void OnBeginDrag(PointerEventData eventData) { if (slot == null || slot.IsEmpty) return; _isDragging = true; - _dragStartPosition = eventData.position; if (_canvasGroup != null) _canvasGroup.blocksRaycasts = false; - if (dragIcon != null && slot.item?.icon != null) + if (_sharedIcon != null && slot.item?.icon != null) { - dragIcon.gameObject.SetActive(true); - dragImage.sprite = slot.item.icon; - dragIcon.localScale = Vector3.one * dragIconScale; - dragIcon.position = eventData.position; + _sharedImage.sprite = slot.item.icon; + _sharedIcon.localScale = Vector3.one * dragIconScale; + _sharedIcon.position = eventData.position; + _sharedIcon.gameObject.SetActive(true); } var bg = GetComponent(); @@ -92,20 +90,19 @@ public class InventoryDragDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, public void OnDrag(PointerEventData eventData) { - if (!_isDragging || dragIcon == null) return; - dragIcon.position = eventData.position; + if (!_isDragging || _sharedIcon == null) return; + _sharedIcon.position = eventData.position; } public void OnEndDrag(PointerEventData eventData) { if (!_isDragging) return; - _isDragging = false; - if (dragIcon != null) + if (_sharedIcon != null) { - dragIcon.gameObject.SetActive(false); - dragIcon.localScale = Vector3.one; + _sharedIcon.gameObject.SetActive(false); + _sharedIcon.localScale = Vector3.one; } if (_canvasGroup != null) @@ -113,124 +110,66 @@ public class InventoryDragDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, var bg = GetComponent(); if (bg != null) - bg.color = slot.IsEmpty ? new Color(0.25f, 0.25f, 0.25f, 0.8f) : new Color(0.35f, 0.35f, 0.35f, 0.95f); + bg.color = slot.IsEmpty + ? new Color(0.25f, 0.25f, 0.25f, 0.8f) + : new Color(0.35f, 0.35f, 0.35f, 0.95f); - // Проверяем - выбросили за пределы инвентаря? - if (allowDropOutside && IsOutsideInventory(eventData.position)) - { - DropItemOutside(); - return; - } - - // Иначе - пробуем переместить в другой слот + // Сначала ищем целевой слот (инвентарь ИЛИ хотбар) var raycastResults = new System.Collections.Generic.List(); EventSystem.current.RaycastAll(eventData, raycastResults); Slot targetSlot = null; - foreach (var result in raycastResults) { - var slotComponent = result.gameObject.GetComponent(); - if (slotComponent != null && slotComponent != slot) - { - targetSlot = slotComponent; - break; - } + var s = result.gameObject.GetComponent(); + if (s != null && s != slot) { targetSlot = s; break; } } - if (targetSlot != null && InventoryManager.Instance != null) + if (targetSlot != null) { - InventoryManager.Instance.SwapSlots(slotIndex, targetSlot.slotIndex); + // Нашли слот — перемещаем (работает и для хотбара) + InventoryManager.Instance?.SwapSlots(slot, targetSlot); + return; } + + // Слот не найден — выбросить в мир если за пределами инвентаря + if (allowDropOutside && IsOutsideInventory(eventData.position)) + DropItemOutside(); } - private bool IsOutsideInventory(Vector2 screenPosition) + // ── Вспомогательные ─────────────────────────────────────────────────────── + + private bool IsOutsideInventory(Vector2 screenPos) { if (_inventoryPanelRect == null) return false; - // Получаем границы панели инвентаря в экранных координатах Vector3[] corners = new Vector3[4]; _inventoryPanelRect.GetWorldCorners(corners); - // rect панели в экранных координатах - float minX = corners[0].x; - float maxX = corners[2].x; - float minY = corners[0].y; - float maxY = corners[2].y; - - // Добавляем отступ - float threshold = dropThreshold; - - // Проверяем находится ли курсор за пределами панели + threshold - bool outside = screenPosition.x < minX - threshold || - screenPosition.x > maxX + threshold || - screenPosition.y < minY - threshold || - screenPosition.y > maxY + threshold; - - return outside; + return screenPos.x < corners[0].x - dropThreshold || + screenPos.x > corners[2].x + dropThreshold || + screenPos.y < corners[0].y - dropThreshold || + screenPos.y > corners[2].y + dropThreshold; } private void DropItemOutside() { if (slot == null || slot.IsEmpty) return; - var item = slot.item; - int amount = slot.amount; + var item = slot.item; + int amount = slot.amount; - // Определяем позицию выброса Vector3 dropPos = Vector3.zero; if (Camera.main != null) - { - // Выбрасываем перед игроком dropPos = Camera.main.transform.position + Camera.main.transform.forward * 2f; - } - // Создаём предмет в мире if (InventoryItemFactory.Instance != null) - { InventoryItemFactory.Instance.DropItem(item, amount, dropPos); - } - else - { - // Fallback - просто создаём объект - var go = new GameObject($"Dropped_{item.itemName}"); - go.transform.position = dropPos; - var visual = GameObject.CreatePrimitive(PrimitiveType.Cube); - visual.transform.SetParent(go.transform); - visual.transform.localPosition = Vector3.zero; - visual.transform.localScale = Vector3.one * 0.3f; - DestroyImmediate(visual.GetComponent()); - - var worldItem = go.AddComponent(); - worldItem.Setup(item, amount); - } - - // Очищаем слот slot.Clear(); - Debug.Log($"[DragDrop] Выброшен: {item.itemName} x{amount}"); } - public void OnPointerEnter(PointerEventData eventData) - { - if (!_isDragging && slot != null && !slot.IsEmpty) - { - var bg = GetComponent(); - if (bg != null) - bg.color = new Color(0.5f, 0.5f, 0.5f, 1f); - } - } - - public void OnPointerExit(PointerEventData eventData) - { - if (!_isDragging && slot != null) - { - var bg = GetComponent(); - if (bg != null) - bg.color = slot.IsEmpty ? - new Color(0.25f, 0.25f, 0.25f, 0.8f) : - new Color(0.35f, 0.35f, 0.35f, 0.95f); - } - } -} \ No newline at end of file + public void OnPointerEnter(PointerEventData eventData) { } + public void OnPointerExit(PointerEventData eventData) { } +} diff --git a/Assets/Inventory/Scripts/InventoryExampleItems.cs b/Assets/Inventory/Scripts/InventoryExampleItems.cs index 0c013bf..9b370e9 100644 --- a/Assets/Inventory/Scripts/InventoryExampleItems.cs +++ b/Assets/Inventory/Scripts/InventoryExampleItems.cs @@ -1,5 +1,6 @@ using UnityEngine; using System.Collections.Generic; +using System.IO; /// /// Пример конфигурации предметов @@ -11,28 +12,43 @@ public class InventoryExampleItems : MonoBehaviour void Awake() { - // Создаём примеры предметов если база пустая + // Создаём примеры предметов если список пустой if (items == null || items.Count == 0) { items = CreateExampleItems(); } - // Передаём в InventoryManager var im = FindObjectOfType(); - if (im != null) - { - im.itemDatabase = items; - im.RebuildItemDictionary(); + if (im == null) return; - // Сразу добавляем тестовые предметы + // Объединяем с существующей базой — не заменяем! + // Так кастомные предметы (tree.asset и т.д.) из Inspector'а сохраняются. + if (im.itemDatabase == null) + im.itemDatabase = new List(); + + foreach (var item in items) + { + if (item != null && !im.itemDatabase.Exists(x => x?.id == item.id)) + im.itemDatabase.Add(item); + } + im.RebuildItemDictionary(); + + // Тестовые предметы добавляем ТОЛЬКО если нет сохранения + // Иначе они будут перезаписаны загрузкой в Start() и появляться снова при каждом запуске + string savePath = Path.Combine(Application.persistentDataPath, "inventory_save.json"); + if (!File.Exists(savePath)) + { im.AddItem("stone", 32); im.AddItem("dirt", 16); im.AddItem("wood", 8); im.AddItem("apple", 5); im.AddItem("sword", 1); im.AddItem("pickaxe", 1); - - Debug.Log("[InventoryExampleItems] Added test items"); + Debug.Log("[InventoryExampleItems] No save found — added test items"); + } + else + { + Debug.Log("[InventoryExampleItems] Save exists — skipping test items, load will restore inventory"); } } diff --git a/Assets/Inventory/Scripts/InventoryItemFactory.cs b/Assets/Inventory/Scripts/InventoryItemFactory.cs index 860a208..48359c9 100644 --- a/Assets/Inventory/Scripts/InventoryItemFactory.cs +++ b/Assets/Inventory/Scripts/InventoryItemFactory.cs @@ -163,11 +163,7 @@ public class InventoryItemFactory : MonoBehaviour } Vector3 spawnPos = dropPosition + offset; - Quaternion rotation = Quaternion.Euler( - Random.Range(0, 360), - Random.Range(0, 360), - Random.Range(0, 360) - ); + Quaternion rotation = Quaternion.identity; var worldItem = CreateWorldItem(itemData, amount, spawnPos, rotation); diff --git a/Assets/Inventory/Scripts/InventoryManager.cs b/Assets/Inventory/Scripts/InventoryManager.cs index 60041fe..d0bb8f2 100644 --- a/Assets/Inventory/Scripts/InventoryManager.cs +++ b/Assets/Inventory/Scripts/InventoryManager.cs @@ -318,10 +318,11 @@ public class InventoryManager : MonoBehaviour } else { - remaining -= slot.amount; + int cleared = slot.amount; // сохранить ДО Clear() + remaining -= cleared; slot.Clear(); - OnItemRemoved?.Invoke(itemId, slot.amount); - InventoryEvents.Instance?.InvokeItemRemoved(itemId, slot.amount); + OnItemRemoved?.Invoke(itemId, cleared); + InventoryEvents.Instance?.InvokeItemRemoved(itemId, cleared); } } } @@ -342,10 +343,11 @@ public class InventoryManager : MonoBehaviour } else { - remaining -= slot.amount; + int cleared = slot.amount; // сохранить ДО Clear() + remaining -= cleared; slot.Clear(); - OnItemRemoved?.Invoke(itemId, slot.amount); - InventoryEvents.Instance?.InvokeItemRemoved(itemId, slot.amount); + OnItemRemoved?.Invoke(itemId, cleared); + InventoryEvents.Instance?.InvokeItemRemoved(itemId, cleared); } } } @@ -447,7 +449,7 @@ public class InventoryManager : MonoBehaviour } /// - /// Поменять предметы между двумя слотами + /// Поменять предметы между двумя слотами (по индексам, только основной инвентарь) /// public void SwapSlots(int fromIndex, int toIndex) { @@ -455,14 +457,19 @@ public class InventoryManager : MonoBehaviour toIndex < 0 || toIndex >= slots.Length) return; - var fromSlot = slots[fromIndex]; - var toSlot = slots[toIndex]; + SwapSlots(slots[fromIndex], slots[toIndex]); + } - // Сохраняем данные - var tempItem = fromSlot.item; + /// + /// Поменять предметы между любыми двумя слотами (инвентарь ↔ хотбар и т.д.) + /// + public void SwapSlots(Slot fromSlot, Slot toSlot) + { + if (fromSlot == null || toSlot == null || fromSlot == toSlot) return; + + var tempItem = fromSlot.item; var tempAmount = fromSlot.amount; - // Меняем if (toSlot.IsEmpty) { fromSlot.Clear(); @@ -541,6 +548,19 @@ public class InventoryManager : MonoBehaviour }; } + if (hotbarSlots != null) + { + inventoryData.hotbarSlots = new SlotData[hotbarSlots.Length]; + for (int i = 0; i < hotbarSlots.Length; i++) + { + inventoryData.hotbarSlots[i] = new SlotData + { + itemId = hotbarSlots[i].item?.id, + amount = hotbarSlots[i].amount + }; + } + } + return JsonUtility.ToJson(inventoryData, true); } @@ -600,12 +620,20 @@ public class InventoryManager : MonoBehaviour { var slotData = inventoryData.slots[i]; if (!string.IsNullOrEmpty(slotData.itemId) && _itemDict.TryGetValue(slotData.itemId, out ItemData item)) - { slots[i].SetItem(item, slotData.amount); - } else - { slots[i].Clear(); + } + + if (inventoryData.hotbarSlots != null && hotbarSlots != null) + { + for (int i = 0; i < Mathf.Min(inventoryData.hotbarSlots.Length, hotbarSlots.Length); i++) + { + var slotData = inventoryData.hotbarSlots[i]; + if (!string.IsNullOrEmpty(slotData.itemId) && _itemDict.TryGetValue(slotData.itemId, out ItemData item)) + hotbarSlots[i].SetItem(item, slotData.amount); + else + hotbarSlots[i].Clear(); } } } @@ -614,6 +642,7 @@ public class InventoryManager : MonoBehaviour class InventorySaveData { public SlotData[] slots; + public SlotData[] hotbarSlots; } [System.Serializable] @@ -623,6 +652,16 @@ public class InventoryManager : MonoBehaviour public int amount; } + void OnDestroy() + { + if (PlayerInput.Instance != null) + { + PlayerInput.Instance.OnToggleInventory -= ToggleInventory; + PlayerInput.Instance.OnDropPressed -= DropSelectedItem; + PlayerInput.Instance.OnHotbarSelect -= SelectHotbarSlot; + } + } + void OnApplicationQuit() { SaveToFile(); diff --git a/Assets/Inventory/Scripts/WorldItem.cs b/Assets/Inventory/Scripts/WorldItem.cs index 147f3c3..edc6656 100644 --- a/Assets/Inventory/Scripts/WorldItem.cs +++ b/Assets/Inventory/Scripts/WorldItem.cs @@ -35,10 +35,16 @@ public class WorldItem : MonoBehaviour itemData = data; amount = count; - if (data.modelPrefab != null) + // Спавним модель только если визуал ещё не встроен в prefab + if (data.modelPrefab != null && transform.childCount == 0) { var model = Instantiate(data.modelPrefab, transform); model.transform.localPosition = Vector3.zero; + + // Удаляем WorldItem из визуальной модели — она только для отображения, + // не должна быть самостоятельным подбираемым объектом + foreach (var wi in model.GetComponentsInChildren()) + Destroy(wi); } if (pickupDelay > 0) @@ -73,6 +79,7 @@ public class WorldItem : MonoBehaviour int remaining = InventoryManager.Instance.AddItem(itemData, amount); if (remaining <= 0) { + CancelInvoke(); // отменяем отложенный EnablePickup если он ещё не сработал Destroy(gameObject); return true; } diff --git a/Assets/Items/ferstitem.prefab b/Assets/Items/ferstitem.prefab deleted file mode 100644 index ea02711..0000000 --- a/Assets/Items/ferstitem.prefab +++ /dev/null @@ -1,135 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &8569222662204961130 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3299916784270131221} - - component: {fileID: 5472821117555071674} - - component: {fileID: 1683734392604781716} - m_Layer: 0 - m_Name: ferstitem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3299916784270131221 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8569222662204961130} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 8775671899748787654} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &5472821117555071674 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8569222662204961130} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b8ac54fbf9ed99e45a83319443952a91, type: 3} - m_Name: - m_EditorClassIdentifier: Assembly-CSharp::WorldItem - itemData: {fileID: 11400000, guid: d870f627519521f4aa24b9a36766465d, type: 2} - amount: 1 - pickupDelay: 0 - interactRange: 2.5 ---- !u!135 &1683734392604781716 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8569222662204961130} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!1001 &746297087722819351 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 3299916784270131221} - m_Modifications: - - target: {fileID: 282714382156279063, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_Name - value: Visual - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} ---- !u!4 &8775671899748787654 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - m_PrefabInstance: {fileID: 746297087722819351} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Items/ferstitem123.prefab b/Assets/Items/ferstitem123.prefab deleted file mode 100644 index 577e8d7..0000000 --- a/Assets/Items/ferstitem123.prefab +++ /dev/null @@ -1,135 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &3773692352489507899 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3475947316444918413} - - component: {fileID: 4358986541640902538} - - component: {fileID: 8290802686145622635} - m_Layer: 0 - m_Name: ferstitem123 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3475947316444918413 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3773692352489507899} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1739540476929525579} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &4358986541640902538 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3773692352489507899} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b8ac54fbf9ed99e45a83319443952a91, type: 3} - m_Name: - m_EditorClassIdentifier: Assembly-CSharp::WorldItem - itemData: {fileID: 11400000, guid: 5db581fdeb06daf4da37cb3d6f32b5ff, type: 2} - amount: 1 - pickupDelay: 0 - interactRange: 2.5 ---- !u!135 &8290802686145622635 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3773692352489507899} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!1001 &3886533962277390174 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 3475947316444918413} - m_Modifications: - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8569222662204961130, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - propertyPath: m_Name - value: Visual - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 06e51a4df39df524397e91edba2a833d, type: 3} ---- !u!4 &1739540476929525579 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 3299916784270131221, guid: 06e51a4df39df524397e91edba2a833d, type: 3} - m_PrefabInstance: {fileID: 3886533962277390174} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Items/item_anim.anim b/Assets/Items/item_anim.anim new file mode 100644 index 0000000..1c15dac --- /dev/null +++ b/Assets/Items/item_anim.anim @@ -0,0 +1,373 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: item_anim + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 360.424, z: 0} + 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: 0.5 + value: {x: 0, y: 0, z: 0} + 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_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0.33, z: 0} + 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: 0.25 + value: {x: 0, y: 0, z: 0} + 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: 0.5 + value: {x: 0, y: 0.33, z: 0} + 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: 4 + script: {fileID: 0} + typeID: 4 + customType: 4 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.5 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + 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: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.x + path: + classID: 4 + script: {fileID: 0} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 360.424 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.y + path: + classID: 4 + script: {fileID: 0} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.z + path: + classID: 4 + script: {fileID: 0} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + 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: 0.33 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0.33 + 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: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.25 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 0 + 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 + m_EulerEditorCurves: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: + classID: 4 + script: {fileID: 0} + flags: 0 + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Items/item_anim.anim.meta b/Assets/Items/item_anim.anim.meta new file mode 100644 index 0000000..a9208f5 --- /dev/null +++ b/Assets/Items/item_anim.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6ea8e562eb5dcf448a92bb8ce4402a66 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Items/newItem.prefab b/Assets/Items/newItem.prefab deleted file mode 100644 index e69de29..0000000 diff --git a/Assets/Items/tree.controller b/Assets/Items/tree.controller new file mode 100644 index 0000000..33d9329 --- /dev/null +++ b/Assets/Items/tree.controller @@ -0,0 +1,73 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: tree + serializedVersion: 6 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 4241218343605681128} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} + m_EvaluateTransitionsOnStart: 1 +--- !u!1107 &4241218343605681128 +AnimatorStateMachine: + serializedVersion: 7 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 4489924751263448603} + m_Position: {x: 200, y: 0, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 4489924751263448603} +--- !u!1102 &4489924751263448603 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: item_anim + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6ea8e562eb5dcf448a92bb8ce4402a66, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Items/tree.controller.meta b/Assets/Items/tree.controller.meta new file mode 100644 index 0000000..f7779b8 --- /dev/null +++ b/Assets/Items/tree.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4d40bb1024b19944b0ba0f85b0fd89f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Items/tree.prefab b/Assets/Items/tree.prefab new file mode 100644 index 0000000..0c2efd9 --- /dev/null +++ b/Assets/Items/tree.prefab @@ -0,0 +1,194 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2501859741750806132 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4239651288264806298} + - component: {fileID: 3599933775027151645} + - component: {fileID: 6068943115296421469} + - component: {fileID: 8918097335992063939} + - component: {fileID: 8272906402636553536} + m_Layer: 6 + m_Name: tree + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4239651288264806298 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2501859741750806132} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: 0.3125369, z: -0, w: 0.94990563} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.33, y: 0.33, z: 0.33} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5719490679037582883} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 36.424, z: 0} +--- !u!114 &3599933775027151645 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2501859741750806132} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b8ac54fbf9ed99e45a83319443952a91, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WorldItem + itemData: {fileID: 11400000, guid: 131ca9b5c83edfe4d9c35a6ef4a380a5, type: 2} + amount: 1 + pickupDelay: 0 + interactRange: 2.5 +--- !u!65 &6068943115296421469 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2501859741750806132} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 0, z: 0} +--- !u!95 &8918097335992063939 +Animator: + serializedVersion: 7 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2501859741750806132} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c4d40bb1024b19944b0ba0f85b0fd89f, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 1 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_AnimatePhysics: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!54 &8272906402636553536 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2501859741750806132} + serializedVersion: 5 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!1001 &5882089278608227351 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 4239651288264806298} + m_Modifications: + - target: {fileID: 1564165088969144462, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_Name + value: Visual + objectReference: {fileID: 0} + - target: {fileID: 1564165088969144462, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_Layer + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7509976937716105303, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + propertyPath: m_Layer + value: 6 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} +--- !u!4 &5719490679037582883 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 2233459345161642548, guid: 3ae36dcb84d70194993d12a9f047bb1c, type: 3} + m_PrefabInstance: {fileID: 5882089278608227351} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Items/newItem.prefab.meta b/Assets/Items/tree.prefab.meta similarity index 74% rename from Assets/Items/newItem.prefab.meta rename to Assets/Items/tree.prefab.meta index 372fb5d..b8e326c 100644 --- a/Assets/Items/newItem.prefab.meta +++ b/Assets/Items/tree.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 580244ac82154544e87abf9ff24eaf82 +guid: fe90e1e2b9dde0943b665ca3768153ae PrefabImporter: externalObjects: {} userData: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 40d6497..48a22f2 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -174,8 +174,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 10247571} slotIndex: 15 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -296,8 +294,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 40474033} slotIndex: 18 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -547,8 +543,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &79398209 MonoBehaviour: @@ -760,8 +756,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &102126490 MonoBehaviour: @@ -897,8 +893,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &102499008 MonoBehaviour: @@ -1101,7 +1097,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 110341034} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ad1628cce096628409729c00123006be, type: 3} m_Name: @@ -1167,7 +1163,8 @@ MonoBehaviour: - {fileID: 1177461549} - {fileID: 1028458913} - {fileID: 2111457907} - itemDatabase: [] + itemDatabase: + - {fileID: 11400000, guid: 131ca9b5c83edfe4d9c35a6ef4a380a5, type: 2} inventoryPanel: {fileID: 1520896305} inventoryCanvas: {fileID: 1751450964} OnItemAdded: @@ -1300,8 +1297,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &113996269 MonoBehaviour: @@ -1533,8 +1530,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 146110191} slotIndex: 7 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -1634,8 +1629,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &148855200 MonoBehaviour: @@ -1847,8 +1842,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &159153827 MonoBehaviour: @@ -2005,8 +2000,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 162822647} slotIndex: 4 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -2285,8 +2278,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 197260292} slotIndex: 22 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -2386,8 +2377,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &209816845 MonoBehaviour: @@ -2523,8 +2514,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &211209737 MonoBehaviour: @@ -2833,8 +2824,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 246414959} slotIndex: 9 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -3030,8 +3019,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 292098840} slotIndex: 3 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -3152,8 +3139,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 293489605} slotIndex: 12 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -3390,8 +3375,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &299017296 MonoBehaviour: @@ -3788,8 +3773,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 340013489} slotIndex: 1 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -4018,8 +4001,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 374206750} slotIndex: 2 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -4140,8 +4121,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 394625754} slotIndex: 11 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -4283,6 +4262,63 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 395476046} m_CullTransparentMesh: 1 +--- !u!1001 &445316300 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2501859741750806132, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_Name + value: tree + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalPosition.x + value: -4.5281076 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalPosition.y + value: 1.05 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalPosition.z + value: 4.463615 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalRotation.w + value: 0.94990563 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalRotation.y + value: 0.3125369 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 36.424 + objectReference: {fileID: 0} + - target: {fileID: 4239651288264806298, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: fe90e1e2b9dde0943b665ca3768153ae, type: 3} --- !u!1 &454962329 GameObject: m_ObjectHideFlags: 0 @@ -4790,8 +4826,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 490502867} slotIndex: 2 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -4966,8 +5000,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &515543453 MonoBehaviour: @@ -5103,8 +5137,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &517810821 MonoBehaviour: @@ -5261,8 +5295,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 536396678} slotIndex: 13 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -5328,77 +5360,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 536396675} m_CullTransparentMesh: 1 ---- !u!1 &537139878 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 537139881} - - component: {fileID: 537139880} - - component: {fileID: 537139879} - m_Layer: 0 - m_Name: NewItem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!135 &537139879 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 537139878} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!114 &537139880 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 537139878} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b8ac54fbf9ed99e45a83319443952a91, type: 3} - m_Name: - m_EditorClassIdentifier: Assembly-CSharp::WorldItem - itemData: {fileID: 0} - amount: 1 - pickupDelay: 0 - interactRange: 2.5 ---- !u!4 &537139881 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 537139878} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1305147278} - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &543496437 GameObject: m_ObjectHideFlags: 0 @@ -5811,8 +5772,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &595421718 MonoBehaviour: @@ -6165,8 +6126,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 630880087} slotIndex: 21 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -6362,8 +6321,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 640005815} slotIndex: 31 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -6614,8 +6571,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &672501192 MonoBehaviour: @@ -6945,8 +6902,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 705913556} slotIndex: 35 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -7162,6 +7117,118 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 734750905} m_CullTransparentMesh: 1 +--- !u!1 &766398186 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 766398187} + - component: {fileID: 766398190} + - component: {fileID: 766398189} + - component: {fileID: 766398188} + m_Layer: 0 + m_Name: hend + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &766398187 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766398186} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.615, y: 0.555, z: 0.629} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1299936657} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!65 &766398188 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766398186} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &766398189 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766398186} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cd99b4c7e235bc845880e647a4111947, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &766398190 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 766398186} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &768549525 GameObject: m_ObjectHideFlags: 0 @@ -7347,8 +7414,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &786907915 MonoBehaviour: @@ -7653,8 +7720,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 791810416} slotIndex: 5 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -7927,8 +7992,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 833155062} slotIndex: 10 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -8049,8 +8112,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 867000488} slotIndex: 23 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -8171,8 +8232,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 869893969} slotIndex: 0 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -8423,8 +8482,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &898022359 MonoBehaviour: @@ -8526,63 +8585,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 898022357} m_CullTransparentMesh: 1 ---- !u!1001 &909735363 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 537139881} - m_Modifications: - - target: {fileID: 282714382156279063, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_Name - value: Visual - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} --- !u!1 &917679926 GameObject: m_ObjectHideFlags: 0 @@ -8658,6 +8660,55 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 917679926} m_CullTransparentMesh: 1 +--- !u!1 &944484400 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 944484402} + - component: {fileID: 944484401} + m_Layer: 0 + m_Name: FlatWorldGenerator + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &944484401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944484400} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f99c115771814a47a3582845ea6426b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::FlatWorldGenerator + chunksX: 64 + chunksZ: 64 + layers: + - blockId: 1 + height: 50 +--- !u!4 &944484402 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 944484400} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &947963413 GameObject: m_ObjectHideFlags: 0 @@ -8692,8 +8743,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &947963415 MonoBehaviour: @@ -8850,8 +8901,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 974060143} slotIndex: 24 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -8917,6 +8966,52 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 974060140} m_CullTransparentMesh: 1 +--- !u!1 &984756777 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 984756779} + - component: {fileID: 984756778} + m_Layer: 0 + m_Name: WorldManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &984756778 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984756777} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5943e32593767dd4aa42fd361ea0be34, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::WorldManager + registry: {fileID: 2060540047} + chunkPrefab: {fileID: 0} +--- !u!4 &984756779 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 984756777} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &990444102 GameObject: m_ObjectHideFlags: 0 @@ -8951,8 +9046,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &990444104 MonoBehaviour: @@ -9088,8 +9183,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &998052618 MonoBehaviour: @@ -9300,8 +9395,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1024804339 MonoBehaviour: @@ -9458,8 +9553,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1028458913} slotIndex: 7 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -9559,8 +9652,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1045593352 MonoBehaviour: @@ -9772,8 +9865,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1087002942 MonoBehaviour: @@ -9930,8 +10023,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1089303442} slotIndex: 5 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -10106,8 +10197,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1102940845 MonoBehaviour: @@ -10394,8 +10485,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1138775581 MonoBehaviour: @@ -10824,8 +10915,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1171187653} slotIndex: 0 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -10946,8 +11035,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1174855395} slotIndex: 26 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -11068,8 +11155,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1177461549} slotIndex: 6 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -11493,8 +11578,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1241157580} slotIndex: 16 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -11804,8 +11887,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1243335394} slotIndex: 30 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -11905,8 +11986,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1243902139 MonoBehaviour: @@ -12138,8 +12219,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1261538903} slotIndex: 28 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -12335,8 +12414,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1288631549} slotIndex: 6 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -12414,6 +12491,7 @@ GameObject: - component: {fileID: 1299936656} - component: {fileID: 1299936655} - component: {fileID: 1299936654} + - component: {fileID: 1299936658} m_Layer: 0 m_Name: Player m_TagString: Player @@ -12433,7 +12511,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a73f597bcce79104fb38225b98ff9348, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::HandEquipSystem - handBone: {fileID: 0} + handBone: {fileID: 766398187} itemOffset: {x: 0, y: 0, z: 0} itemRotation: {x: 0, y: 0, z: 0} itemScale: {x: 1, y: 1, z: 1} @@ -12472,7 +12550,7 @@ CharacterController: m_Bits: 0 m_ExcludeLayers: serializedVersion: 2 - m_Bits: 0 + m_Bits: 64 m_LayerOverridePriority: 0 m_ProvidesContacts: 0 m_Enabled: 1 @@ -12501,13 +12579,28 @@ Transform: - {fileID: 343408062} - {fileID: 1751450961} - {fileID: 1141020901} + - {fileID: 766398187} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!4 &1305147278 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 8327738622413892305, guid: 4fcbba5b8725e254f98c052c4db89e02, type: 3} - m_PrefabInstance: {fileID: 909735363} +--- !u!114 &1299936658 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1299936653} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f550906f577c6db498f5d7923f708fbb, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::BlockPlacer + reach: 5 + breakTime: 1 + blockLayer: + serializedVersion: 2 + m_Bits: 128 + breakMaterial: {fileID: 1575648575} + crackTexture: {fileID: 2800000, guid: 33720838b907c1946a85dd4af6ec99bc, type: 3} --- !u!1 &1336412460 GameObject: m_ObjectHideFlags: 0 @@ -12617,8 +12710,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1349490554 MonoBehaviour: @@ -12754,8 +12847,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1350539450 MonoBehaviour: @@ -12891,8 +12984,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1354242036 MonoBehaviour: @@ -13028,8 +13121,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1367559381 MonoBehaviour: @@ -13186,8 +13279,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1369233939} slotIndex: 20 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -13437,8 +13528,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1380141814 MonoBehaviour: @@ -13595,8 +13686,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1381801743} slotIndex: 17 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -13944,8 +14033,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1410955506} slotIndex: 25 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -14196,8 +14283,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1477081371 MonoBehaviour: @@ -14354,8 +14441,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1500059189} slotIndex: 14 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -14629,8 +14714,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1534160695} slotIndex: 29 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -14730,8 +14813,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1537607497 MonoBehaviour: @@ -14888,8 +14971,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1542655671} slotIndex: 4 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -15031,6 +15112,40 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1573173217} m_CullTransparentMesh: 1 +--- !u!21 &1575648575 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blocks/BlockBreak + m_Shader: {fileID: 4800000, guid: cb42248eaf3ad004dab200504cb05d47, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _CrackTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Progress: 0 + m_Colors: + - _Color: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 --- !u!1 &1617982998 GameObject: m_ObjectHideFlags: 0 @@ -15086,8 +15201,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1617983001} slotIndex: 19 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -15187,8 +15300,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1624776581 MonoBehaviour: @@ -15324,8 +15437,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1625905176 MonoBehaviour: @@ -15536,8 +15649,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1646153631 MonoBehaviour: @@ -15735,8 +15848,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1687954830 MonoBehaviour: @@ -15893,8 +16006,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1696180087} slotIndex: 1 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -15994,8 +16105,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1716499562 MonoBehaviour: @@ -16131,8 +16242,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1717738574 MonoBehaviour: @@ -16289,8 +16400,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1722711625} slotIndex: 3 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -16390,8 +16499,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1724337743 MonoBehaviour: @@ -16548,8 +16657,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1742827910} slotIndex: 27 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -16829,20 +16936,20 @@ Canvas: m_GameObject: {fileID: 1751450960} m_Enabled: 1 serializedVersion: 3 - m_RenderMode: 0 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 + m_RenderMode: 1 + m_Camera: {fileID: 181126236} + m_PlaneDistance: 1 + m_PixelPerfect: 1 m_ReceivesEvents: 1 m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 - m_VertexColorAlwaysGammaSpace: 0 + m_VertexColorAlwaysGammaSpace: 1 m_UseReflectionProbes: 0 - m_AdditionalShaderChannelsFlag: 0 - m_UpdateRectTransformForStandalone: 0 + m_AdditionalShaderChannelsFlag: -1 + m_UpdateRectTransformForStandalone: 1 m_SortingLayerID: 0 - m_SortingOrder: 100 + m_SortingOrder: 1 m_TargetDisplay: 0 --- !u!1 &1768887824 GameObject: @@ -17051,8 +17158,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1820319977} slotIndex: 32 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -17399,8 +17504,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1854226139} slotIndex: 33 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -17651,8 +17754,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1870730220 MonoBehaviour: @@ -18091,8 +18194,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1911604278 MonoBehaviour: @@ -18325,8 +18428,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 1933910249} slotIndex: 8 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -18577,8 +18678,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2006280743 MonoBehaviour: @@ -18907,6 +19008,53 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2040488833} m_CullTransparentMesh: 1 +--- !u!1 &2060540046 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2060540048} + - component: {fileID: 2060540047} + m_Layer: 0 + m_Name: BlockRegistry + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2060540047 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2060540046} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 68a1a0f0ab870014ba9a973042ee35b4, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::BlockRegistry + definitions: + - {fileID: 11400000, guid: f827f1cb7a209854598b7f1ee52d32e4, type: 2} + voxelShader: {fileID: 4800000, guid: 0061d561024e79d49851acdeda5f39c9, type: 3} +--- !u!4 &2060540048 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2060540046} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2061597198 GameObject: m_ObjectHideFlags: 0 @@ -19038,8 +19186,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 2070608008} slotIndex: 34 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -19310,8 +19456,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2084195601 MonoBehaviour: @@ -19447,8 +19593,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2086323923 MonoBehaviour: @@ -19584,8 +19730,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2106341929 MonoBehaviour: @@ -19742,8 +19888,6 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::InventoryDragDrop slot: {fileID: 2111457907} slotIndex: 8 - dragIcon: {fileID: 0} - dragImage: {fileID: 0} dragIconScale: 1.2 allowDropOutside: 1 dropThreshold: 100 @@ -19918,8 +20062,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 50} + m_AnchoredPosition: {x: -5, y: -0.75} + m_SizeDelta: {x: -2, y: -1.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2120171765 MonoBehaviour: @@ -20183,4 +20327,7 @@ SceneRoots: - {fileID: 1679807690} - {fileID: 110341037} - {fileID: 1299936657} - - {fileID: 537139881} + - {fileID: 2060540048} + - {fileID: 984756779} + - {fileID: 944484402} + - {fileID: 445316300} diff --git a/Assets/charecter-controller/scripts/PlayerInput.cs b/Assets/charecter-controller/scripts/PlayerInput.cs index 7ec829f..90ca845 100644 --- a/Assets/charecter-controller/scripts/PlayerInput.cs +++ b/Assets/charecter-controller/scripts/PlayerInput.cs @@ -16,10 +16,14 @@ public class PlayerInput : MonoBehaviour public InputActionAsset actions; // ── Непрерывные значения ────────────────────────────────────────────────── - public Vector2 MoveInput { get; private set; } - public Vector2 LookInput { get; private set; } - public bool Crouch { get; private set; } - public bool Run { get; private set; } + public Vector2 MoveInput { get; private set; } + public Vector2 LookInput { get; private set; } + public bool Crouch { get; private set; } + public bool Run { get; private set; } + /// ЛКМ удержана (разрушение блока). False когда инвентарь открыт. + public bool BreakHeld { get; private set; } + /// ПКМ нажата в этом кадре (постановка блока). False когда инвентарь открыт. + public bool PlacePressed { get; private set; } // ── Дискретные события ──────────────────────────────────────────────────── public event Action OnToggleInventory; @@ -107,12 +111,17 @@ public class PlayerInput : MonoBehaviour void Update() { - if (_gameplayMap == null || !_gameplayMap.enabled) return; + bool gameplayActive = _gameplayMap != null && _gameplayMap.enabled; - MoveInput = _gameplayMap["Move"].ReadValue(); - LookInput = _gameplayMap["Look"].ReadValue(); - Crouch = _gameplayMap["Crouch"].IsPressed(); - Run = _gameplayMap["Run"].IsPressed(); + MoveInput = gameplayActive ? _gameplayMap["Move"].ReadValue() : Vector2.zero; + LookInput = gameplayActive ? _gameplayMap["Look"].ReadValue() : Vector2.zero; + Crouch = gameplayActive && _gameplayMap["Crouch"].IsPressed(); + Run = gameplayActive && _gameplayMap["Run"].IsPressed(); + + // Мышь через New Input System — отключаются вместе с gameplay + var mouse = UnityEngine.InputSystem.Mouse.current; + BreakHeld = gameplayActive && (mouse?.leftButton.isPressed ?? false); + PlacePressed = gameplayActive && (mouse?.rightButton.wasPressedThisFrame ?? false); } // ── Сохранение/загрузка биндингов ──────────────────────────────────────── diff --git a/Assets/charecter-controller/scripts/charecter.cs b/Assets/charecter-controller/scripts/charecter.cs index 8b4d1bc..1a9c156 100644 --- a/Assets/charecter-controller/scripts/charecter.cs +++ b/Assets/charecter-controller/scripts/charecter.cs @@ -60,9 +60,20 @@ public class charecter : MonoBehaviour } PlayerInput.Instance.OnPickupPressed += TryPickupNearbyItem; - PlayerInput.Instance.OnJumpPressed += () => { _jumpRequested = true; }; + PlayerInput.Instance.OnJumpPressed += OnJumpPressed; } + void OnDestroy() + { + if (PlayerInput.Instance != null) + { + PlayerInput.Instance.OnPickupPressed -= TryPickupNearbyItem; + PlayerInput.Instance.OnJumpPressed -= OnJumpPressed; + } + } + + void OnJumpPressed() => _jumpRequested = true; + void Update() { HandleLook(); @@ -85,14 +96,19 @@ public class charecter : MonoBehaviour foreach (var col in colliders) { - var worldItem = col.GetComponent(); + // Ищем WorldItem на коллайдере ИЛИ на любом родителе — + // чтобы дочерние меши (Visual, default и т.д.) тоже находили своего владельца + var worldItem = col.GetComponentInParent(); if (worldItem == null) continue; + // Дедупликация: пропускаем если этот WorldItem уже учтён через другой коллайдер + if (worldItem == closestItem) continue; + float dist = Vector3.Distance(transform.position, worldItem.transform.position); if (dist < closestDist && dist <= worldItem.interactRange) { - closestDist = dist; - closestItem = worldItem; + closestDist = dist; + closestItem = worldItem; } } @@ -143,7 +159,7 @@ public class charecter : MonoBehaviour if (_jumpRequested && !isCrouching) { _verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * gravity); - _anim?.SetTrigger(HashJump); + if (_anim != null) _anim.SetTrigger(HashJump); } _jumpRequested = false; } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index eb5d9ae..75acbad 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -11,8 +11,8 @@ TagManager: - - Water - UI - - - - + - item + - Blocks - - - @@ -43,3 +43,4 @@ TagManager: locked: 0 m_RenderingLayers: - Default + m_MigratedRenderPipelines: []