-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #529 from misternebula/dev
0.20.0
- Loading branch information
Showing
107 changed files
with
2,840 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
QSB/Animation/Player/Thrusters/RemoteThrusterParticlesBehaviour.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using QSB.Player; | ||
using QSB.Utility; | ||
using UnityEngine; | ||
|
||
namespace QSB.Animation.Player.Thrusters; | ||
|
||
internal class RemoteThrusterParticlesBehaviour : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private Thruster _thruster; | ||
|
||
[SerializeField] | ||
private bool _underwaterParticles; | ||
|
||
private bool _initialized; | ||
private PlayerInfo _attachedPlayer; | ||
private RemotePlayerFluidDetector _fluidDetector; | ||
private ParticleSystem _thrustingParticles; | ||
private Vector3 _thrusterFilter; | ||
private bool _underwater; | ||
|
||
public void Init(PlayerInfo player) | ||
{ | ||
_attachedPlayer = player; | ||
_fluidDetector = player.FluidDetector; | ||
_thrustingParticles = gameObject.GetComponent<ParticleSystem>(); | ||
_thrustingParticles.GetComponent<CustomRelativisticParticleSystem>().Init(player); | ||
_thrusterFilter = OWUtilities.GetShipThrusterFilter(_thruster); | ||
_underwater = false; | ||
_thrustingParticles.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); | ||
|
||
_fluidDetector.OnEnterFluidType += OnEnterExitFluidType; | ||
_fluidDetector.OnExitFluidType += OnEnterExitFluidType; | ||
|
||
_initialized = true; | ||
} | ||
|
||
private void OnDestroy() | ||
{ | ||
_initialized = false; | ||
if (_fluidDetector != null) | ||
{ | ||
_fluidDetector.OnEnterFluidType -= OnEnterExitFluidType; | ||
_fluidDetector.OnExitFluidType -= OnEnterExitFluidType; | ||
} | ||
} | ||
|
||
private void Update() | ||
{ | ||
if (!_initialized) | ||
{ | ||
return; | ||
} | ||
|
||
if (((_underwater != _underwaterParticles) | ||
? 0f | ||
: Vector3.Dot(_attachedPlayer.JetpackAcceleration.AccelerationVariableSyncer.Value, _thrusterFilter)) > 1f) | ||
{ | ||
if (!_thrustingParticles.isPlaying) | ||
{ | ||
_thrustingParticles.Play(); | ||
return; | ||
} | ||
} | ||
else if (_thrustingParticles.isPlaying) | ||
{ | ||
_thrustingParticles.Stop(); | ||
} | ||
} | ||
|
||
private void OnEnterExitFluidType(FluidVolume.Type type) | ||
{ | ||
_underwater = _fluidDetector.InFluidType(FluidVolume.Type.WATER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.