ShaderGraph demo

This commit is contained in:
2026-06-08 14:48:14 +02:00
parent ed8fda0907
commit 4103f5edc7
13 changed files with 19457 additions and 190 deletions

File diff suppressed because one or more lines are too long

View File

@@ -4846,9 +4846,6 @@ GameObject:
m_Component:
- component: {fileID: 2452438183559969328}
- component: {fileID: 5498746363113909859}
- component: {fileID: 7489720413787656316}
- component: {fileID: 969273971065403761}
- component: {fileID: 1297323364034544193}
- component: {fileID: 1895831434844119828}
m_Layer: 0
m_Name: RocketExplosion
@@ -4881,103 +4878,6 @@ MeshFilter:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7101154270830653306}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &7489720413787656316
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7101154270830653306}
m_Enabled: 0
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: 31321ba15b8f8eb4c954353edc038b1d, 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!135 &969273971065403761
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7101154270830653306}
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_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &1297323364034544193
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7101154270830653306}
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: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &1895831434844119828
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -4991,7 +4891,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::RocketExplosion
_references:
Collider: {fileID: 969273971065403761}
Explosion: {fileID: 6192230712846423339}
_settings:
Radius: 10
Radius: 5
Strength: 1000

File diff suppressed because it is too large Load Diff

View File

@@ -104,6 +104,9 @@ public class Player : MonoBehaviour
[Tooltip("Animation center of gravity")]
[Range(-1, 1)] public float AnimationCenter;
[Tooltip("Elapsed time since falling")]
[Range(-1, 1)] public float FallingTime;
[Tooltip("Elapsed time since sticked to wall")]
[Range(-1, 1)] public float StickedTime;
@@ -146,6 +149,7 @@ public class Player : MonoBehaviour
private float _groundCheckRadius;
private Collider[] _overlapResults = new Collider[1];
private Vector3 _wallDirection;
private Vector3 _wallNormal;
private Vector3 _wallPosition;
private Vector3 _lastPlatformPosition;
private Quaternion _lastPlatformRotation;
@@ -224,6 +228,11 @@ public class Player : MonoBehaviour
bool isGrounded = rayHit || sphereHit;
// Wall run
if (_settings.WallRun.CanRunOnWalls && !_state.CanStickToWalls)
{
_state.CanStickToWalls = _state.FallingTime > .3f;
}
bool isStickedToWall = false;
if (!isGrounded && _settings.WallRun.CanRunOnWalls && _state.CanStickToWalls && _state.VerticalVelocity < 0)
{
@@ -263,6 +272,7 @@ public class Player : MonoBehaviour
if (_state.IsStickedToWall)
{
_wallDirection = Vector3.ProjectOnPlane(Vector3.Cross(rayInfo.normal, Vector3.up), Vector3.up) * Mathf.Sign(Vector3.Cross(transform.forward, rayInfo.normal).y);
_wallNormal = rayInfo.normal;
_wallPosition = rayInfo.point;
_state.AnimationCenter = raySign;
_state.Running = 1;
@@ -324,6 +334,8 @@ public class Player : MonoBehaviour
// Reset platform velocity
_platformVelocity = Vector3.zero;
_state.FallingTime = 0; ;
}
else
{
@@ -340,6 +352,7 @@ public class Player : MonoBehaviour
_platformVelocity = platformVelocity;
}
_state.FallingTime += deltaTime;
_state.Ground = null;
}
}
@@ -393,8 +406,25 @@ public class Player : MonoBehaviour
}
moveInput *= speed; // Muliply move by speed
_state.Velocity.x = moveInput.x;
_state.Velocity.z = moveInput.z;
float velovityTime = deltaTime * 8;
switch (_state.CurrentState)
{
default:
velovityTime *= 1;
break;
case PlayerState.Jumping:
velovityTime *= .5f;
break;
case PlayerState.Falling:
velovityTime *= .2f;
break;
}
_state.Velocity.x = Mathf.Lerp(_state.Velocity.x, moveInput.x, velovityTime);
_state.Velocity.z = Mathf.Lerp(_state.Velocity.z, moveInput.z, velovityTime);
// Rotate Player
if (moveInput.sqrMagnitude > .001f)
@@ -414,7 +444,11 @@ public class Player : MonoBehaviour
{
if (_jumpAction.triggered && (_state.IsGrounded || _state.IsStickedToWall))
{
_state.Velocity.y = _settings.JumpForce;
if (_state.IsStickedToWall)
_state.Velocity = Vector3.Lerp(_wallNormal, Vector3.up, .4f).normalized * _settings.JumpForce * 1.6f;
else
_state.Velocity.y = _settings.JumpForce;
_state.Ground = null;
_state.IsStickedToWall = false;
_state.CanStickToWalls = false;

View File

@@ -5,7 +5,6 @@ public class RocketExplosion : MonoBehaviour
[System.Serializable]
public class References
{
public SphereCollider Collider;
public ParticleSystem Explosion;
}
@@ -13,15 +12,36 @@ public class RocketExplosion : MonoBehaviour
public class Settings
{
public float Radius = 5;
public float Strength = 1000;
}
[SerializeField] private References _references;
[SerializeField] private Settings _settings;
private float radius;
private float time;
//private float radius;
//private float time;
void Awake()
void Start()
{
Vector3 originPos = transform.position;
Collider[] colliders = Physics.OverlapSphere(originPos, _settings.Radius);
foreach (Collider hit in colliders)
{
Rigidbody rb = hit.GetComponent<Rigidbody>();
if (rb != null)
{
float strength = _settings.Strength;
strength *= 1 - Vector3.Distance(originPos, hit.transform.position) / _settings.Radius;
rb.AddExplosionForce(strength, originPos, _settings.Radius);
}
}
}
/*void Awake()
{
radius = 1;
_references.Explosion.Play();
@@ -36,5 +56,5 @@ public class RocketExplosion : MonoBehaviour
time += Time.deltaTime;
if (time > 5)
Destroy(gameObject);
}
}*/
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2c4332f5f40ed1d4f9e367900658a325
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
useAsTemplate: 0
exposeTemplateAsShader: 0
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2a802416a7e0d3243b0f94d499f9a428
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
useAsTemplate: 0
exposeTemplateAsShader: 0
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8c31539cbab6b054bb6771e5c9fd54f3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
useAsTemplate: 0
exposeTemplateAsShader: 0
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 686dda421146ea44f9306d2861c7b99c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
useAsTemplate: 0
exposeTemplateAsShader: 0
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}