Skip to content

Commit

Permalink
Fix bullet fire trails, fix boombardier explosion initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Fueredoriku committed Jan 6, 2025
1 parent 8f4f367 commit 35bda07
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Assets/Prefabs/GunParts/DynamiteBarrel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ AudioSource:
m_GameObject: {fileID: 5146486171313696063}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
OutputAudioMixerGroup: {fileID: 4898656368289658944, guid: 92cf7610df7967a41806df0e74d33c49, type: 2}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using JetBrains.Annotations;
using Mirror;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;

Expand Down Expand Up @@ -135,7 +137,7 @@ private void OnDeath(PlayerManager killer, PlayerManager victim, DamageInfo info
private void OnDestroy()
{
StopAllCoroutines();
if (!gunController || !gunController.Player)
if (!gunController || !gunController.Player || !gunController.Player.IsAlive)
return;

activeDynamites.ForEach(dynamite => dynamite.gameObject.SetActive(false));
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Augment/AugmentImplementations/Fire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private void PlayShotAudio(GunStats stats)

private void OnDestroy()
{
stuckFirePool.Flush();
stuckFirePool?.Flush();
positionActiveBuffer?.Dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ private void OnEnable()
ResetDynamite();
}

private void Awake()
{
ResetDynamite();
}

public void ResetDynamite()
{
explosion.StopAllCoroutines();
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/Augment/BulletController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class BulletController : ProjectileController

private const float baseSpeed = 50f;

private const int defaultProjectileCount = 512;

private VFXTextureFormatter trailPositionBuffer;

[SerializeField]
Expand Down Expand Up @@ -78,6 +80,7 @@ private void RpcSeedRandom(int seed)

public void SetTrail(VisualEffect newTrail)
{
trailPositionBuffer ??= new(defaultProjectileCount);
trailPositionBuffer.Buffer?.Release();
trail = newTrail;
if (trail && stats)
Expand Down
28 changes: 15 additions & 13 deletions Assets/Scripts/Augment/GunController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,22 @@ public void UnsubscribeDelegates()
onInitializeBullet = null;
onReload = null;

projectile.OnColliderHit = null;
projectile.OnHitboxCollision = null;
projectile.OnNetworkInit = null;
projectile.OnProjectileInit = null;
projectile.OnProjectileTravel = null;
projectile.OnRicochet = null;

if (!barrelAnimator)
return;

if (projectile)
{
projectile.OnColliderHit = null;
projectile.OnHitboxCollision = null;
projectile.OnNetworkInit = null;
projectile.OnProjectileInit = null;
projectile.OnProjectileTravel = null;
projectile.OnRicochet = null;
}

barrelAnimator.OnShotFiredAnimation -= PlayRecoil;
barrelAnimator.OnShotFiredAnimation -= ShotFired;
barrelAnimator.OnAnimationEnd -= FireEnd;
if (barrelAnimator)
{
barrelAnimator.OnShotFiredAnimation -= PlayRecoil;
barrelAnimator.OnShotFiredAnimation -= ShotFired;
barrelAnimator.OnAnimationEnd -= FireEnd;
}

if (!Player || !Player.inputManager)
return;
Expand Down

0 comments on commit 35bda07

Please sign in to comment.