Browse Source
First version of particle trail, supporting rocket trail, smoke trail and blood trail.
readme
First version of particle trail, supporting rocket trail, smoke trail and blood trail.
readme
13 changed files with 5014 additions and 20 deletions
-
22Assets/Scripts/Data/QConstants.cs
-
13Assets/Scripts/Modules/GameModule.Interop.cs
-
30Assets/Scripts/Modules/GameModule.cs
-
106Assets/Scripts/Support/ParticleTrailController.cs
-
3Assets/Scripts/Support/ParticleTrailController.cs.meta
-
17Assets/Scripts/VisualStyle.cs
-
2Assets/Styles/Original/GLQuake.asset
-
4819Assets/Styles/Original/Particles/ParticleTrail.prefab
-
7Assets/Styles/Original/Particles/ParticleTrail.prefab.meta
-
2Assets/Styles/Original/Software.asset
-
2engine/Quake/r_part.c
-
1engine/Quake/render.h
-
6engine/UniQuake/game_uniquake.c
@ -0,0 +1,106 @@ |
|||
using System.Collections; |
|||
using UnityEngine; |
|||
|
|||
public class ParticleTrailController : MonoBehaviour |
|||
{ |
|||
private Vector3 endPosition; |
|||
|
|||
public void Initialize(ParticleSystem effect, ParticleTrail type, Vector3 end, int interval) |
|||
{ |
|||
endPosition = end; |
|||
|
|||
var main = effect.main; |
|||
var shape = effect.shape; |
|||
|
|||
var emission = effect.emission; |
|||
emission.rateOverDistance = 1.0f / interval; |
|||
|
|||
switch (type) |
|||
{ |
|||
case ParticleTrail.Rocket: |
|||
{ |
|||
main.startLifetime = new ParticleSystem.MinMaxCurve(0.6f, 1.2f); |
|||
shape.scale = new Vector3(6f, 6f, 6f); |
|||
|
|||
var colorOverLifetime = effect.colorOverLifetime; |
|||
colorOverLifetime.enabled = true; |
|||
colorOverLifetime.color = SetupGradients(RocketColorKeys, SmokeColorKeys); |
|||
break; |
|||
} |
|||
case ParticleTrail.Smoke: |
|||
{ |
|||
main.startLifetime = new ParticleSystem.MinMaxCurve(0.2f, 0.8f); |
|||
shape.scale = new Vector3(6f, 6f, 6f); |
|||
|
|||
var colorOverLifetime = effect.colorOverLifetime; |
|||
colorOverLifetime.enabled = true; |
|||
colorOverLifetime.color = SetupGradients(SmokeColorKeys, SmokeColorKeys2); |
|||
break; |
|||
} |
|||
case ParticleTrail.Blood: |
|||
{ |
|||
main.gravityModifierMultiplier = 0.05f; |
|||
main.startColor = new ParticleSystem.MinMaxGradient( |
|||
new Color32(31, 0, 0, 255), |
|||
new Color32(55, 0, 0, 255)); |
|||
|
|||
shape.scale = new Vector3(6f, 6f, 6f); |
|||
break; |
|||
} |
|||
case ParticleTrail.Tracer: |
|||
case ParticleTrail.Tracer2: |
|||
{ |
|||
break; |
|||
} |
|||
case ParticleTrail.SlightBlood: |
|||
{ |
|||
break; |
|||
} |
|||
case ParticleTrail.VoreBall: |
|||
{ |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
IEnumerator Start() |
|||
{ |
|||
// Instantly move the particle emitter to its end position, to force it to emit all particles at once
|
|||
yield return null; |
|||
transform.position = endPosition; |
|||
} |
|||
|
|||
private static ParticleSystem.MinMaxGradient SetupGradients(GradientColorKey[] minKeys, GradientColorKey[] maxKeys) |
|||
{ |
|||
return new ParticleSystem.MinMaxGradient |
|||
{ |
|||
mode = ParticleSystemGradientMode.TwoGradients, |
|||
gradientMin = new Gradient { mode = GradientMode.Fixed, colorKeys = minKeys }, |
|||
gradientMax = new Gradient { mode = GradientMode.Fixed, colorKeys = maxKeys }, |
|||
}; |
|||
} |
|||
|
|||
private static readonly GradientColorKey[] RocketColorKeys = |
|||
{ |
|||
new GradientColorKey(new Color32(223, 171, 39, 255), 0.167f), |
|||
new GradientColorKey(new Color32(191, 119, 47, 255), 0.333f), |
|||
new GradientColorKey(new Color32(91, 91, 91, 255), 0.5f), |
|||
new GradientColorKey(new Color32(75, 75, 75, 255), 0.667f), |
|||
new GradientColorKey(new Color32(63, 63, 63, 255), 0.833f), |
|||
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f), |
|||
}; |
|||
|
|||
private static readonly GradientColorKey[] SmokeColorKeys = |
|||
{ |
|||
new GradientColorKey(new Color32(91, 91, 91, 255), 0.25f), |
|||
new GradientColorKey(new Color32(75, 75, 75, 255), 0.5f), |
|||
new GradientColorKey(new Color32(63, 63, 63, 255), 0.75f), |
|||
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f), |
|||
}; |
|||
|
|||
private static readonly GradientColorKey[] SmokeColorKeys2 = |
|||
{ |
|||
new GradientColorKey(new Color32(63, 63, 63, 255), 0.5f), |
|||
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f), |
|||
}; |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 7220fa57562e4a48b6fc17e6bfc0a945 |
|||
timeCreated: 1628089994 |
|||
4819
Assets/Styles/Original/Particles/ParticleTrail.prefab
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,7 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 6f6d855fe9d5e524b9293af4fd7caf21 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue