Added more rumbling!!!

This commit is contained in:
BOT Alex 2024-02-04 06:50:33 +01:00
parent c97c58c400
commit ca210eed69
5 changed files with 48 additions and 20 deletions

View File

@ -274,8 +274,6 @@ GameObject:
- component: {fileID: 1749848915408613053}
- component: {fileID: 1949941092232239315}
- component: {fileID: 1449424410418603396}
- component: {fileID: 8584374946327201457}
- component: {fileID: 2455289449300252362}
- component: {fileID: 3389629528887116870}
- component: {fileID: 1160419468000791564}
- component: {fileID: 1691493459240420355}
@ -447,6 +445,21 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6b097a132c072b72fbc7808ebf263e52, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3389629528887116870
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 20d294d88e5bc8a42afb1f72751fb61f, type: 3}
m_Name:
m_EditorClassIdentifier:
RopeRubleTolerance: 0.25
MaxVibration: 0.8
rope: {fileID: 0}
--- !u!114 &1160419468000791564
MonoBehaviour:
m_ObjectHideFlags: 0
@ -475,21 +488,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
StepInterval: 0.8
Volume: 0.25
--- !u!114 &3389629528887116870
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 20d294d88e5bc8a42afb1f72751fb61f, type: 3}
m_Name:
m_EditorClassIdentifier:
RopeRubleTolerance: 0.25
MaxVibration: 0.8
rope: {fileID: 0}
--- !u!1001 &6225877037457186740
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -1169,6 +1169,10 @@ PrefabInstance:
propertyPath: rope
value:
objectReference: {fileID: 1920006248}
- target: {fileID: 5108819328747686001, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3}
propertyPath: MaxVibration
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7071433868121438663, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3}
propertyPath: otherPlayerAttack
value:
@ -1476,6 +1480,10 @@ PrefabInstance:
propertyPath: rope
value:
objectReference: {fileID: 1920006248}
- target: {fileID: 3389629528887116870, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3}
propertyPath: MaxVibration
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -4001,6 +4009,10 @@ PrefabInstance:
propertyPath: m_Name
value: Blood
objectReference: {fileID: 0}
- target: {fileID: 4056614590725156132, guid: a99c6b890ab711f4faebdfd6335c5f16, type: 3}
propertyPath: RumbleAmount
value: 100
objectReference: {fileID: 0}
- target: {fileID: 6363525508243884259, guid: a99c6b890ab711f4faebdfd6335c5f16, type: 3}
propertyPath: m_LocalPosition.x
value: 0

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using ComputeShaderUtility;
@ -33,6 +34,8 @@ public class BloodComputeShader : MonoBehaviour
public float splatterVolume = 0.0f;
public AudioSource splatterPlayer;
public float RumbleAmount = 100;
ComputeBuffer particleBuffer;
ComputeBuffer positionBuffer;
ComputeBuffer numParticlesConsumedBuffer;
@ -158,6 +161,9 @@ public class BloodComputeShader : MonoBehaviour
score += bufferData[0];
float mappedRumble = Convert.ToSingle(bufferData[0]).Remap(0, RumbleAmount, 0, 0.1f);
RumbleManager.StartRumble(-1, 0, mappedRumble, 0.1f);
squeakVolume += 0.1f;
// Reset counter
@ -264,7 +270,7 @@ public class BloodComputeShader : MonoBehaviour
bloodCompute.SetVector("particleInitPos", loc);
bloodCompute.SetInt("particlesToInitialize", found);
Vector3 pow = Random.insideUnitSphere * power;
Vector3 pow = UnityEngine.Random.insideUnitSphere * power;
pow.z = Mathf.Abs(pow.z);
bloodCompute.SetVector("initialVelocity",pow);

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@ -11,13 +12,24 @@ public class EnemyPathFinding : MonoBehaviour
[SerializeField] private float ropeDistCheck = 1f;
[SerializeField] private LayerMask ropeCheckMask;
private HealthComponent healthComponent;
NavMeshAgent agent;
private void Start()
{
agent = GetComponent<NavMeshAgent>();
agent.updateRotation = false;
agent.updateUpAxis = false;
healthComponent = GetComponent<HealthComponent>();
healthComponent.OnHealthZero.AddListener(Rumble);
}
private void Rumble()
{
RumbleManager.StartRumble(-1, 1f, 1f, 0.5f);
}
private void Update()
{
if (targets.Length == 0) return;

View File

@ -42,7 +42,7 @@ public class RopeRumbling : MonoBehaviour
float ropeClamed = Mathf.Max(0, rope.Overshoot);
float sensitive_mapped = ropeClamed.Remap(0.2f, 1f, 0f, MaxVibration);
float mapped = ropeClamed.Remap(0.5f, 1f, 0f, MaxVibration);
RumbleManager.StartRumble(-1, sensitive_mapped, mapped, 0.1f);
float mapped = ropeClamed.Remap(0.9f, 1f, 0f, MaxVibration);
RumbleManager.StartRumble(-1, mapped, sensitive_mapped, 0.1f);
}
}