Particles implemented

This commit is contained in:
Rapandrasmus 2024-02-10 15:20:46 +01:00
parent c62e6fa1a0
commit e7220c0f4d
7 changed files with 155 additions and 5 deletions

View file

@ -44,7 +44,7 @@ ParticleSystem:
serializedVersion: 8
lengthInSec: 1
simulationSpeed: 1.2
stopAction: 0
stopAction: 2
cullingMode: 0
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
@ -9942,7 +9942,7 @@ ParticleSystem:
serializedVersion: 8
lengthInSec: 1
simulationSpeed: 1.2
stopAction: 0
stopAction: 2
cullingMode: 0
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
@ -14796,6 +14796,37 @@ ParticleSystemRenderer:
m_MeshWeighting2: 1
m_MeshWeighting3: 1
m_MaskInteraction: 0
--- !u!1 &342526040255713266
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 912007196473728721}
m_Layer: 0
m_Name: ParticleCutPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &912007196473728721
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 342526040255713266}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -2.41, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2298792418077467027}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &530568906956625335
GameObject:
m_ObjectHideFlags: 0
@ -14876,7 +14907,7 @@ ParticleSystem:
serializedVersion: 8
lengthInSec: 1
simulationSpeed: 1.2
stopAction: 0
stopAction: 2
cullingMode: 0
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
@ -20009,7 +20040,7 @@ ParticleSystem:
serializedVersion: 8
lengthInSec: 1
simulationSpeed: 1.2
stopAction: 0
stopAction: 2
cullingMode: 0
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
@ -25031,6 +25062,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1717766863558984628
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6412579525062198344}
m_Layer: 0
m_Name: ParticleHitPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6412579525062198344
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1717766863558984628}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.54, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2298792418077467027}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2010293588750359072
GameObject:
m_ObjectHideFlags: 0
@ -30269,6 +30331,8 @@ Transform:
- {fileID: 3502128156805934089}
- {fileID: 9079661336676261219}
- {fileID: 3003928064201585482}
- {fileID: 912007196473728721}
- {fileID: 6412579525062198344}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -30317,6 +30381,13 @@ MonoBehaviour:
- {fileID: 5461475411022461785}
- {fileID: 6866122181738215028}
- {fileID: 7551078816062909441}
_particleHitPoint: {fileID: 6412579525062198344}
_particleCutPoint: {fileID: 912007196473728721}
_smallLogCutParticle: {fileID: 7462153235099924466}
_bigLogHitParticle: {fileID: 3979740605485083186}
_bigLogCutParticle: {fileID: 2750562534684413619}
_hugeLogHitParticle: {fileID: 4548977897624448614}
_hugeLogCutParticle: {fileID: 9061173392440300293}
_catAnimationOffsetStart: -0.5
_catAnimationOffsetEnd: 0.5
_catMoveLength: 0.5
@ -46314,7 +46385,7 @@ ParticleSystem:
serializedVersion: 8
lengthInSec: 1
simulationSpeed: 1.2
stopAction: 0
stopAction: 2
cullingMode: 0
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}

View file

@ -65,6 +65,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
SoundByte.PlayOneShotGame("lumbearjack/hitVoice" + (Random.Range(1, 3) == 1 ? "A" : "B"));
SoundByte.PlayOneShotGame("lumbearjack/baseHit");
LumBEARjack.instance.DoBigObjectEffect(_type, true);
string hitSound = _type switch
{
LumBEARjack.BigType.log => "bigLogHit",
@ -87,6 +89,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
SoundByte.PlayOneShotGame("lumbearjack/bigLogCutVoice");
LumBEARjack.instance.DoBigObjectEffect(_type, false);
string cutSound = _type switch
{
LumBEARjack.BigType.log => "bigLogCut",

View file

@ -141,6 +141,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
SoundByte.PlayOneShotGame("lumbearjack/" + (_type == LumBEARjack.HugeType.peach ? "peach" : "hit") + "Voice" + (Random.Range(1, 3) == 1 ? "A" : "B"));
SoundByte.PlayOneShotGame("lumbearjack/baseHit");
LumBEARjack.instance.DoHugeObjectEffect(_type, true);
string hitSound = _type switch
{
LumBEARjack.HugeType.log => $"hugeLogHit{step}",
@ -166,6 +168,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
SoundByte.PlayOneShotGame("lumbearjack/" + (_type == LumBEARjack.HugeType.peach ? "peachCutVoice" : "hugeLogCutVoice"));
LumBEARjack.instance.DoHugeObjectEffect(_type, false);
string cutSound = _type switch
{
LumBEARjack.HugeType.log => "hugeLogCut",

View file

@ -97,6 +97,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
};
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
LumBEARjack.instance.DoSmallObjectEffect(_type);
switch (_huh)
{
case LumBEARjack.HuhChoice.ObjectSpecific:

View file

@ -271,6 +271,16 @@ namespace HeavenStudio.Games
[SerializeField] private GameObject[] _catLeftObjectsBig = new GameObject[1];
[SerializeField] private GameObject[] _catLeftObjectsHuge = new GameObject[3];
[SerializeField] private Transform _particleHitPoint;
[SerializeField] private Transform _particleCutPoint;
[Header("Particles")]
[SerializeField] private ParticleSystem _smallLogCutParticle;
[SerializeField] private ParticleSystem _bigLogHitParticle;
[SerializeField] private ParticleSystem _bigLogCutParticle;
[SerializeField] private ParticleSystem _hugeLogHitParticle;
[SerializeField] private ParticleSystem _hugeLogCutParticle;
[Header("Parameters")]
[SerializeField] private double _catAnimationOffsetStart = -0.5;
[SerializeField] private double _catAnimationOffsetEnd = 0.5;
@ -896,6 +906,53 @@ namespace HeavenStudio.Games
#endregion
#region Particles and Effects
public void DoSmallObjectEffect(SmallType type)
{
switch (type)
{
case SmallType.log:
ParticleSystem spawnedParticle = Instantiate(_smallLogCutParticle, _particleCutPoint);
spawnedParticle.PlayScaledAsyncAllChildren(0.75f);
break;
case SmallType.can:
break;
case SmallType.bat:
break;
case SmallType.broom:
break;
}
}
public void DoBigObjectEffect(BigType type, bool hit)
{
switch (type)
{
case BigType.log:
ParticleSystem spawnedParticle = Instantiate(hit ? _bigLogHitParticle : _bigLogCutParticle, hit ? _particleHitPoint : _particleCutPoint);
spawnedParticle.PlayScaledAsyncAllChildren(0.75f);
break;
}
}
public void DoHugeObjectEffect(HugeType type, bool hit)
{
switch (type)
{
case HugeType.log:
ParticleSystem spawnedParticle = Instantiate(hit ? _hugeLogHitParticle : _hugeLogCutParticle, hit ? _particleHitPoint : _particleCutPoint);
spawnedParticle.PlayScaledAsyncAllChildren(0.75f);
break;
case HugeType.freezer:
break;
case HugeType.peach:
break;
}
}
#endregion
#region Misc
public void RestBear(bool instant, bool sound)

View file

@ -16,6 +16,17 @@ namespace HeavenStudio.Util
ParticleSystem.MainModule main = particleSystem.main;
main.simulationSpeed = (1 / Conductor.instance.pitchedSecPerBeat) * timeScale;
}
public static void PlayScaledAsyncAllChildren(this ParticleSystem particleSystem, float timeScale)
{
particleSystem.PlayScaledAsync(timeScale);
foreach (var p in particleSystem.GetComponentsInChildren<ParticleSystem>())
{
if (p == particleSystem) continue;
p.PlayScaledAsyncAllChildren(timeScale);
}
}
}
}

View file

@ -293,5 +293,6 @@ MonoBehaviour:
- Assets/Scripts/Games/LumBEARjack/LBJBear.cs
- Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs
- Assets/Scripts/Games/LumBEARjack/LBJCatMove.cs
- Assets/Scripts/Util/ParticleSystemHelpers.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []