Compare commits

..

2 Commits

Author SHA1 Message Date
Sveske Juice 007350dc3f Merge remote-tracking branch 'refs/remotes/origin/main' 2024-04-21 10:11:52 +02:00
Sveske Juice 71e74eb373 fixed something 2024-04-21 10:11:44 +02:00
4 changed files with 72 additions and 23 deletions

View File

@ -22,3 +22,4 @@ MonoBehaviour:
- {fileID: 8300000, guid: ad2e8b18611ebba43823cd2f2381dc0b, type: 3} - {fileID: 8300000, guid: ad2e8b18611ebba43823cd2f2381dc0b, type: 3}
- {fileID: 8300000, guid: b388d47fcdeb4434bb6b8f8617c8031f, type: 3} - {fileID: 8300000, guid: b388d47fcdeb4434bb6b8f8617c8031f, type: 3}
- {fileID: 8300000, guid: 79ca1f1673c4d574d8424e518f9c3517, type: 3} - {fileID: 8300000, guid: 79ca1f1673c4d574d8424e518f9c3517, type: 3}
- {fileID: 8300000, guid: e850f3f8ab5051943a09bc30110ad96a, type: 3}

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,7 @@ ParticleSystem:
ringBufferMode: 0 ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1} ringBufferLoopRange: {x: 0, y: 1}
emitterVelocityMode: 1 emitterVelocityMode: 1
looping: 1 looping: 0
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
useUnscaledTime: 0 useUnscaledTime: 0
@ -5041,6 +5041,10 @@ MonoBehaviour:
damage: 10 damage: 10
wallRebounces: 4 wallRebounces: 4
comingFrom: {fileID: 0} comingFrom: {fileID: 0}
OnReflect:
m_PersistentCalls:
m_Calls: []
splashPS: {fileID: 2459575551296835979}
--- !u!108 &8572678539923306418 --- !u!108 &8572678539923306418
Light: Light:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -24,6 +24,8 @@ public class Projectile : MonoBehaviour
private Vector3 prevVel; private Vector3 prevVel;
[SerializeField] ParticleSystem splashPS;
private void Awake() private void Awake()
{ {
projCol = GetComponent<Collider>(); projCol = GetComponent<Collider>();
@ -40,6 +42,15 @@ public class Projectile : MonoBehaviour
projCol.material = pMat; projCol.material = pMat;
} }
void Start()
{
if (splashPS != null)
{
splashPS.time = 0f;
splashPS.Play();
}
}
private void LateUpdate() private void LateUpdate()
{ {
prevVel = body.velocity; prevVel = body.velocity;
@ -49,7 +60,7 @@ public class Projectile : MonoBehaviour
{ {
HealthComponent hitHealthComp = collision.gameObject.GetComponent<HealthComponent>(); HealthComponent hitHealthComp = collision.gameObject.GetComponent<HealthComponent>();
if (hitHealthComp == null) if (hitHealthComp == null)
hitHealthComp = collision.transform.root.GetComponentInChildren<HealthComponent>(); hitHealthComp = collision.transform.parent.GetComponent<HealthComponent>();
// if (hitHealthComp == comingFrom) return; // if (hitHealthComp == comingFrom) return;
if (hitHealthComp) if (hitHealthComp)
{ {
@ -66,6 +77,12 @@ public class Projectile : MonoBehaviour
body.velocity = newVel.normalized * prevVel.magnitude * bounciness; body.velocity = newVel.normalized * prevVel.magnitude * bounciness;
OnReflect?.Invoke(); OnReflect?.Invoke();
AudioManager.PlaySound("BulletBounce", transform.position); AudioManager.PlaySound("BulletBounce", transform.position);
if (splashPS != null)
{
splashPS.time = 0f;
splashPS.Play();
}
} }
} }
} }