整理美术资源
6
unity/.vsconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
||||
@@ -883,7 +883,7 @@ Transform:
|
||||
m_GameObject: {fileID: 330585543}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956}
|
||||
m_LocalPosition: {x: 0, y: 5, z: -6.99}
|
||||
m_LocalPosition: {x: 0, y: 8, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -946,7 +946,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
target: {fileID: 441783843}
|
||||
offset: {x: 0, y: 6.25, z: -7.5}
|
||||
offset: {x: 0, y: 8, z: -10}
|
||||
--- !u!1 &338266639
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
8
unity/Assets/Scenes/res.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: DX5KtX+lBXIaXtVUILykYdLl4zMSmZ7W9PoEupSl6+r76/9GNXeE1Lw=
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
8
unity/Assets/Scenes/res/object.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: Cn8d5nyqUypHBc3PlXSVAcGFYCL5FYaBHGZq43WU7tRX8a7FWYAKLuM=
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 208 KiB |
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 232 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
8
unity/Assets/Scenes/res/player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: XCsbsi38VCg2OvxSGS3oGO1eNiTfBRpF7zgzhQrGlGh3+RTNDgb/J+E=
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 9.1 MiB After Width: | Height: | Size: 9.1 MiB |
|
Before Width: | Height: | Size: 9.1 MiB After Width: | Height: | Size: 9.1 MiB |
68
unity/Assets/camera/YSorter.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Y-Sort 排序器 —— 根据物体的Y坐标(世界空间)动态调整Sprite的sortingOrder。
|
||||
///
|
||||
/// 原理:
|
||||
/// 在2.5D等距视角游戏中,Y坐标代表"前后"关系(Y越小=越远=越靠后)。
|
||||
/// 本脚本每帧根据物体的Y坐标计算sortingOrder,Y值越小排序值越小,
|
||||
/// 这样后面的物体会被前面的物体遮挡,实现正确的前后遮挡关系。
|
||||
///
|
||||
/// 用法:
|
||||
/// 1. 挂到所有需要参与Y-Sort的Sprite物体上(玩家、敌人、树木、石头等)
|
||||
/// 2. 设置 baseSortingOrder 区分不同类型的物体(如地面=0,角色=1000,UI=2000)
|
||||
/// 3. 确保所有参与排序的Sprite在同一个Sorting Layer上
|
||||
///
|
||||
/// 注意:
|
||||
/// - 本脚本假设摄像机从斜上方俯视(Y轴代表前后)
|
||||
/// - 所有参与排序的物体必须在同一个Sorting Layer
|
||||
/// - 建议给不同类型的物体设置不同的baseSortingOrder以避免冲突
|
||||
/// </summary>
|
||||
public class YSorter : MonoBehaviour
|
||||
{
|
||||
[Tooltip("基础排序值,用于区分不同类型的物体(如地面=0,角色=1000)")]
|
||||
[SerializeField] private int baseSortingOrder = 0;
|
||||
|
||||
[Tooltip("Y坐标到sortingOrder的缩放系数(值越大,前后物体排序差异越明显)")]
|
||||
[SerializeField] private float scaleFactor = 100f;
|
||||
|
||||
[Tooltip("是否每帧更新(关闭则只在移动时更新,性能更好)")]
|
||||
[SerializeField] private bool updateEveryFrame = true;
|
||||
|
||||
private SpriteRenderer _spriteRenderer;
|
||||
private Vector3 _lastPosition;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
|
||||
if (_spriteRenderer == null)
|
||||
{
|
||||
Debug.LogWarning($"YSorter: 物体 {gameObject.name} 没有找到SpriteRenderer组件");
|
||||
}
|
||||
_lastPosition = transform.position;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (_spriteRenderer == null) return;
|
||||
|
||||
// 如果设置了不是每帧更新,只在位置改变时更新
|
||||
if (!updateEveryFrame && transform.position == _lastPosition)
|
||||
return;
|
||||
|
||||
UpdateSortingOrder();
|
||||
_lastPosition = transform.position;
|
||||
}
|
||||
|
||||
private void UpdateSortingOrder()
|
||||
{
|
||||
// Y值越小(越远),sortingOrder越小
|
||||
// 使用负号是因为Unity中Y轴向上为正,但我们需要Y越小=越靠后
|
||||
int sortingOrder = baseSortingOrder - Mathf.RoundToInt(transform.position.y * scaleFactor);
|
||||
|
||||
if (_spriteRenderer.sortingOrder != sortingOrder)
|
||||
{
|
||||
_spriteRenderer.sortingOrder = sortingOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
unity/Assets/camera/YSorter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: CCgY4CyqVHkfAUXU0+AZevsbEL7ex49jkAXnw8oz9TQ6JplkI3k2lCQ=
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,17 +15,17 @@ EditorUserSettings:
|
||||
value: 50025251565751035a5b0a7b44250944144f4e7d7d787336782a4a37b6b7606f
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-3:
|
||||
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 5055070050010c5a0e5d0d27497a0e441016412c2f7d206178714f61b3b8326b
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-5:
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 5004505e50045a0e5f57097b14250f444615407b287b7e657f704c31b5b36660
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
RecentlyUsedSceneGuid-5:
|
||||
value: 5b090d000402580a5c5b087648735e4445151e737b717334757b1832b1b93261
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-6:
|
||||
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-7:
|
||||
value: 5a55515156575a0b0f56592346260f444f16197c7e7f24697d2a4a32b1b0353e
|
||||
flags: 0
|
||||
|
||||