Browse Source

Allow visual style to modify the particle templates during init, so GLQuake and Software styles can share the same particle systems, but apply different particle sizes and materials. Also slightly tweaked the minimum particle size on all effects.

readme
Nico de Poel 5 years ago
parent
commit
852878765b
  1. 40
      Assets/Scripts/VisualStyle.cs
  2. 2
      Assets/Styles/GLQuake/GLQuake.asset
  3. 4
      Assets/Styles/GLQuake/Particles/BlobExplosion.prefab
  4. 2
      Assets/Styles/GLQuake/Particles/LavaSplash.prefab
  5. 2
      Assets/Styles/GLQuake/Particles/ParticleEffect.prefab
  6. 4
      Assets/Styles/GLQuake/Particles/ParticleExplosion.prefab
  7. 2
      Assets/Styles/GLQuake/Particles/RogueExplosion.prefab
  8. 2
      Assets/Styles/GLQuake/Particles/RoundParticle.mat
  9. 0
      Assets/Styles/GLQuake/Particles/RoundParticle.mat.meta
  10. 142
      Assets/Styles/GLQuake/Particles/SquareParticle.mat
  11. 8
      Assets/Styles/GLQuake/Particles/SquareParticle.mat.meta
  12. 2
      Assets/Styles/GLQuake/Particles/TeleportSplash.prefab
  13. 15
      Assets/Styles/GLQuake/Software.asset

40
Assets/Scripts/VisualStyle.cs

@ -30,6 +30,8 @@ public class VisualStyle : ScriptableObject
public virtual void Activate()
{
particles.Init();
if (pointSampling)
Shader.EnableKeyword("_POINT_SAMPLING");
else
@ -152,6 +154,12 @@ public class LiquidProperties
[System.Serializable]
public class ParticleSystems
{
[SerializeField]
protected Material particleMaterial;
[SerializeField]
protected float particleSize = 1.0f;
[SerializeField]
protected ParticleSystem particleEffect;
@ -170,6 +178,38 @@ public class ParticleSystems
[SerializeField]
protected ParticleSystem lavaSplash;
public virtual void Init()
{
InitTemplate(particleEffect);
InitTemplate(explosion);
InitTemplate(rogueExplosion);
InitTemplate(blobExplosion);
InitTemplate(teleportSplash);
InitTemplate(lavaSplash);
}
protected virtual void InitTemplate(ParticleSystem template)
{
if (template == null)
return;
var main = template.main;
main.startSize = particleSize;
if (particleMaterial != null)
{
var renderer = template.GetComponent<ParticleSystemRenderer>();
renderer.sharedMaterial = particleMaterial;
}
int childCount = template.transform.childCount;
for (int i = 0; i < childCount; ++i)
{
var child = template.transform.GetChild(i);
InitTemplate(child.GetComponent<ParticleSystem>());
}
}
public virtual void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count, Layers layer)
{
var effect = InstantiateEffect(particleEffect, position, layer);

2
Assets/Styles/GLQuake/GLQuake.asset

@ -23,6 +23,8 @@ MonoBehaviour:
lavaAlpha: 0.9
teleAlpha: 1
particles:
particleMaterial: {fileID: 2100000, guid: 4224080a2fee880419642256cbfaee41, type: 2}
particleSize: 1.38
particleEffect: {fileID: 9150008102338277659, guid: d911d6d226122ae4e97a2fc6f268503d,
type: 3}
explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55,

4
Assets/Styles/GLQuake/Particles/BlobExplosion.prefab

@ -4921,7 +4921,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.002
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0
@ -10107,7 +10107,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.002
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

2
Assets/Styles/GLQuake/Particles/LavaSplash.prefab

@ -4839,7 +4839,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

2
Assets/Styles/GLQuake/Particles/ParticleEffect.prefab

@ -4839,7 +4839,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

4
Assets/Styles/GLQuake/Particles/ParticleExplosion.prefab

@ -4840,7 +4840,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0
@ -9702,7 +9702,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

2
Assets/Styles/GLQuake/Particles/RogueExplosion.prefab

@ -4839,7 +4839,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

2
Assets/Styles/GLQuake/Particles/Particle.mat → Assets/Styles/GLQuake/Particles/RoundParticle.mat

@ -20,7 +20,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Particle
m_Name: RoundParticle
m_Shader: {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4

0
Assets/Styles/GLQuake/Particles/Particle.mat.meta → Assets/Styles/GLQuake/Particles/RoundParticle.mat.meta

142
Assets/Styles/GLQuake/Particles/SquareParticle.mat

@ -0,0 +1,142 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-826508141333875548
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SquareParticle
m_Shader: {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2001
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 36f6501e4b60c3d4bab2eb2659039dc4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 1
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

8
Assets/Styles/GLQuake/Particles/SquareParticle.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63b15323c45f06d4995fa1512a83cbcd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

2
Assets/Styles/GLQuake/Particles/TeleportSplash.prefab

@ -4839,7 +4839,7 @@ ParticleSystemRenderer:
m_SortingOrder: 0
m_RenderMode: 0
m_SortMode: 0
m_MinParticleSize: 0.003
m_MinParticleSize: 0.0025
m_MaxParticleSize: 0.5
m_CameraVelocityScale: 0
m_VelocityScale: 0

15
Assets/Styles/GLQuake/Software.asset

@ -23,4 +23,17 @@ MonoBehaviour:
lavaAlpha: 1
teleAlpha: 1
particles:
explosion: {fileID: 0}
particleMaterial: {fileID: 2100000, guid: 63b15323c45f06d4995fa1512a83cbcd, type: 2}
particleSize: 1.08
particleEffect: {fileID: 9150008102338277659, guid: d911d6d226122ae4e97a2fc6f268503d,
type: 3}
explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55,
type: 3}
rogueExplosion: {fileID: 9150008102338277659, guid: 0a1fede38a8884d488bcf7625cad527e,
type: 3}
blobExplosion: {fileID: 9150008102338277659, guid: 3bc17ebf070910f4592c9491152e94b4,
type: 3}
teleportSplash: {fileID: 9150008102338277659, guid: 79bef89ba1457cb42a9fbeaf4acff66f,
type: 3}
lavaSplash: {fileID: 9150008102338277659, guid: 4db0c926dce46fe4c90920ecd8c5df2e,
type: 3}
Loading…
Cancel
Save