最新修改后提交

This commit is contained in:
高铎 2025-09-23 14:54:59 +08:00
parent 6621b7c370
commit f162ddb353
24 changed files with 51430 additions and 713 deletions

View File

@ -125,6 +125,7 @@ MonoBehaviour:
m_Version: 0
m_Tracks:
- {fileID: -8040467985507400763}
- {fileID: 8343031591517442995}
m_FixedDuration: 0
m_EditorSettings:
m_Framerate: 60
@ -153,3 +154,321 @@ MonoBehaviour:
m_Loop: 0
m_Version: 1
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
--- !u!114 &8343031591517442995
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d21dcc2386d650c4597f3633c75a1f98, type: 3}
m_Name: Animation Track (1)
m_EditorClassIdentifier:
m_Version: 3
m_AnimClip: {fileID: 0}
m_Locked: 0
m_Muted: 0
m_CustomPlayableFullTypename:
m_Curves: {fileID: 0}
m_Parent: {fileID: 11400000}
m_Children: []
m_Clips: []
m_Markers:
m_Objects: []
m_InfiniteClipPreExtrapolation: 1
m_InfiniteClipPostExtrapolation: 1
m_InfiniteClipOffsetPosition: {x: 0.23064011, y: 1.1151208, z: 0.100568086}
m_InfiniteClipOffsetEulerAngles: {x: -0, y: 14.999999, z: 0}
m_InfiniteClipTimeOffset: 0
m_InfiniteClipRemoveOffset: 0
m_InfiniteClipApplyFootIK: 1
mInfiniteClipLoop: 0
m_MatchTargetFields: 63
m_Position: {x: 0, y: 0, z: 0}
m_EulerAngles: {x: 0, y: 0, z: 0}
m_AvatarMask: {fileID: 0}
m_ApplyAvatarMask: 1
m_TrackOffset: 0
m_InfiniteClip: {fileID: 8975377450033155017}
m_OpenClipOffsetRotation: {x: 0, y: 0, z: 0, w: 1}
m_Rotation: {x: 0, y: 0, z: 0, w: 1}
m_ApplyOffsets: 0
--- !u!74 &8975377450033155017
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Recorded
serializedVersion: 7
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: {x: 0.000002980232, y: -0.000002803438, z: 0.00000000126758}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0, 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: 2.5
value: {x: 0, y: 0.00000023841858, 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: 2.5166667
value: {x: 0.044934943, y: -0.06354082, z: -0.038034044}
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
- serializedVersion: 2
path: 0
attribute: 4
script: {fileID: 0}
typeID: 4
customType: 4
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 2.5166667
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: 0.000002980232
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.x
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: -0.000002803438
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.y
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: 0.00000000126758
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: localEulerAnglesRaw.z
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5166667
value: 0.044934943
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}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: 0.00000023841858
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5166667
value: -0.06354082
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}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 2.5
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5166667
value: -0.038034044
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}
m_EulerEditorCurves:
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.x
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.y
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalEulerAngles.z
path:
classID: 4
script: {fileID: 0}
m_HasGenericRootTransform: 1
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -9,33 +9,36 @@ public class RongMaoSkinMesh : MonoBehaviour
{
public int Count = 0;
//public Shader shader;
[Header("渲染目标")]
[Header("渲染目标")]
[SerializeField]
private Renderer Target;
public Shader BaseShader;
[Header("皮毛物理")]
[Header("皮毛物理")]
public int LayerCount = 10;
public float FurLength = 0.5f;
public float FurLength = 0.5f;
public Vector3 FurFore;
public Texture2D Noise;
public Texture2D Noise2;
public Texture2D MainTex;//毛发颜色
public Texture2D Mask;//不产生毛发区域的灰度遮罩
[Header("皮毛渲染")]
[Header("皮毛渲染")]
//毛发染色
public Color FurColor=Color.white;
public Color ShadowColor=Color.white;
[Range(0,1)]public float ShadowStrength = 0.3f;
public Color FurColor = Color.white;
public Color ShadowColor = Color.white;
[Range(0, 1)] public float ShadowStrength = 0.3f;
[Range(0.01f, 1)] public float R = 0.5f;
[Range(0, 3)] public float _LengthMut = 1;
public float Density = 1;
[Header("是否使用GPU实例化")]
public bool isInStance = false;
public bool ZWrite = true;
public int RenderSort = 0;
private bool skinHasValue = false;
private Renderer target;
//创建毛发
@ -43,10 +46,10 @@ public class RongMaoSkinMesh : MonoBehaviour
private Material layerMat;
private SkinnedMeshRenderer skinnedMeshRenderer;
private MaterialPropertyBlock mpb;
private ComputeBuffer instanceBuffer;
private Matrix4x4[] instanceMatrices;
private bool isInit;
void OnEnable()
{
@ -56,13 +59,17 @@ public class RongMaoSkinMesh : MonoBehaviour
void LateUpdate()
{
//目标为空就不渲染
if(TargetChange()==false) return;
if(isInStance) UpDateInstance();
if (TargetChange() == false)
{
Debug.Log("返回");
return;
}
isInStance = false;
if (isInStance) UpDateInstance();
else UpDateMesh();
}
bool TargetChange()
{
if (Target != target)
@ -72,16 +79,16 @@ public class RongMaoSkinMesh : MonoBehaviour
}
return isInit;
}
//初始化毛发,返回是否初始化成功
bool Init()
{
if(target.IsUnityNull()) return false;
if (target.IsUnityNull()) return false;
CreateFur();
MeshInstancedData();
if (target.GetType() == typeof(MeshRenderer))
{
mesh=target.GetComponent<MeshFilter>().sharedMesh;
mesh = target.GetComponent<MeshFilter>().sharedMesh;
skinHasValue = false;
}
else
@ -92,28 +99,30 @@ public class RongMaoSkinMesh : MonoBehaviour
return true;
}
//初始化网格、材质、SkinnedMeshRenderer
void CreateFur()
{
mesh = new Mesh();
layerMat =new Material(BaseShader);
layerMat.SetTexture("_MainTex",MainTex);
layerMat.SetColor("_Color",FurColor);
layerMat.SetFloat("_FurLength",FurLength);
layerMat.SetTexture("_Noise",Noise);
layerMat.SetTexture("_Noise2",Noise2);
layerMat.SetTexture("_Mask",Mask);
layerMat.SetColor("_ShadowColor",ShadowColor);
layerMat.SetFloat("_R",R);
layerMat.SetFloat("_LayerCount",LayerCount);
layerMat.renderQueue = 3000;
layerMat = new Material(BaseShader);
layerMat.SetTexture("_MainTex", MainTex);
layerMat.SetColor("_Color", FurColor);
layerMat.SetFloat("_FurLength", FurLength);
layerMat.SetTexture("_Noise", Noise);
layerMat.SetTexture("_Noise2", Noise2);
layerMat.SetTexture("_Mask", Mask);
layerMat.SetColor("_ShadowColor", ShadowColor);
layerMat.SetFloat("_R", R);
layerMat.SetFloat("_LayerCount", LayerCount);
layerMat.SetInt("_ZWrite", ZWrite ? 1 : 0);
layerMat.SetFloat("_Density", Density);
layerMat.renderQueue = 3000 + RenderSort;
mpb = new MaterialPropertyBlock();
}
void MeshInstancedData()
{
instanceMatrices = new Matrix4x4[LayerCount];
@ -121,26 +130,29 @@ public class RongMaoSkinMesh : MonoBehaviour
// 随机生成实例的位置和旋转
for (int i = 0; i < LayerCount; i++)
{
Vector3 position = target.transform.position;
Quaternion rotation = target.transform.rotation;
Vector3 scale = Vector3.one;
//Vector3 position = target.transform.position;
//Quaternion rotation = target.transform.rotation;
//Vector3 scale = Vector3.one;
instanceMatrices[i] = Matrix4x4.TRS(position, rotation, scale);
instanceMatrices[i] = target.transform.localToWorldMatrix;// //Matrix4x4.TRS(position, rotation, scale);
}
}
//使用GPU实例化
void UpDateInstance()
{
if (skinHasValue)
{
skinnedMeshRenderer.BakeMesh(mesh);
}
for (int i = 0; i < LayerCount; i++)
{
instanceMatrices[i] = target.transform.localToWorldMatrix;
}
layerMat.EnableKeyword("INSTANCE");
Graphics.DrawMeshInstanced(mesh,0,layerMat,instanceMatrices,LayerCount);
Graphics.DrawMeshInstanced(mesh, 0, layerMat, instanceMatrices, LayerCount);
}
//未使用GPU实例化
void UpDateMesh()
@ -149,17 +161,17 @@ public class RongMaoSkinMesh : MonoBehaviour
{
skinnedMeshRenderer.BakeMesh(mesh);
}
layerMat.DisableKeyword("INSTANCE");
float furOffset = 1.0f / LayerCount;
for (int i = 0; i < LayerCount; i++)
{
mpb.SetFloat("_LayerOffset",i*furOffset);
Graphics.DrawMesh(mesh,target.transform.localToWorldMatrix,layerMat,0,Camera.main,0,mpb);
mpb.SetFloat("_LayerOffset", i * furOffset);
Graphics.DrawMesh(mesh, target.transform.localToWorldMatrix, layerMat, 0, Camera.main, 0, mpb);
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
using FSM;
using ZXKFramework;
namespace DongWuYiXue.QiGuanChaGuan
{
public class BingLiXinXiState : FsmState<FSMManager>
@ -7,12 +8,28 @@ namespace DongWuYiXue.QiGuanChaGuan
{
base.OnStateEnter();
this.Log("进入病例信息状态");
fsm.ShowTip(0, true);
fsm.ShowCamera("病例信息1_Camera");
fsm.PlayClip("病例信息_TimeLine", () =>
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
{
fsm.nextState = true;
});
GameManager.Instance.uiManager.ShowUI<StartKaoHePanel>();
GameManager.Instance.uiManager.GetUI<StartKaoHePanel>().callback = () =>
{
fsm.ShowTip(0, true);
fsm.ShowCamera("病例信息1_Camera");
fsm.PlayClip("病例信息_TimeLine", () =>
{
fsm.nextState = true;
});
};
}
else if (fsm.main_gameModel.modeType == ModeType.ShiXun)
{
fsm.ShowTip(0, true);
fsm.ShowCamera("病例信息1_Camera");
fsm.PlayClip("病例信息_TimeLine", () =>
{
fsm.nextState = true;
});
}
}
public override void OnStateStay()
{

View File

@ -43,6 +43,10 @@ namespace DongWuYiXue.QiGuanChaGuan
fsm.nextState = true;
});
}
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
{
fsm.nextState = true;
}
});
}
}

View File

@ -11,7 +11,7 @@ namespace DongWuYiXue.QiGuanChaGuan
bool isTui;
float tuiValue;
Coroutine cor;
Coroutine cor2;
Coroutine cor2;
public override void OnStateEnter()
{
base.OnStateEnter();
@ -42,6 +42,7 @@ namespace DongWuYiXue.QiGuanChaGuan
if (Input.GetKeyDown(KeyCode.L))
{
laValue = 1.0f;
fsm.PlayClip("³äӯθÄÒÀ­_TimeLine", null, laValue);
}
if (laValue >= 1.0f)
{
@ -55,7 +56,7 @@ namespace DongWuYiXue.QiGuanChaGuan
}
isLa = false;
laValue = 0;
cor2=Game.Instance.IEnumeratorManager.Run(1.0f, () =>
cor2 = Game.Instance.IEnumeratorManager.Run(1.0f, () =>
{
isTui = true;
});

View File

@ -40,6 +40,10 @@ namespace DongWuYiXue.QiGuanChaGuan
fsm.nextState = true;
});
}
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
{
fsm.nextState = true;
}
});
}
});

View File

@ -11,6 +11,7 @@ namespace DongWuYiXue.QiGuanChaGuan
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
{
fsm.AddScore(5, 0);
fsm.nextState = true;
}
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
{