|
1 | 1 | using UnityEngine; |
2 | 2 |
|
3 | | - |
4 | | -public class FSBDparticleFX |
5 | | -{ |
6 | | - |
7 | | - public GameObject gameObject; |
8 | | - public GameObject parentObject; |
9 | | - public Texture particleTexture; |
10 | | - public bool useLocalSpaceVelocityHack = false; |
11 | | - |
12 | | - public ParticleEmitter pEmitter; |
13 | | - public ParticleRenderer pRenderer; |
14 | | - public ParticleAnimator pAnimator; |
15 | | - |
16 | | - private bool componentsAdded = false; |
17 | | - |
18 | | - #region component variables |
19 | | - |
20 | | - public string RendererShader = "Particles/Alpha Blended"; |
21 | | - |
22 | | - public float EmitterMinSize = 0.1f; |
23 | | - public float EmitterMaxSize = 0.2f; |
24 | | - public float EmitterMinEnergy = 0.1f; |
25 | | - public float EmitterMaxEnergy = 0.8f; |
26 | | - public float EmitterMinEmission = 120f; |
27 | | - public float EmitterMaxEmission = 160f; |
28 | | - public Vector3 EmitterLocalVelocity = new Vector3(0f, 0f, 1f); |
29 | | - public Vector3 EmitterRndVelocity = new Vector3(0f, 0.1f, 0.1f); |
30 | | - public bool EmitterUseWorldSpace = true; |
31 | | - public bool EmitterRandomRotation = true; |
32 | | - |
33 | | - public bool AnimatorDoesAnimateColor = true; |
34 | | - |
35 | | - public Color AnimatorColor0 = new Color(0.2f, 0.2f, 0.2f, 0.1f); |
36 | | - public Color AnimatorColor1 = new Color(0.3f, 0.3f, 0.3f, 0.1f); |
37 | | - public Color AnimatorColor2 = new Color(0.5f, 0.5f, 0.5f, 0.09f); |
38 | | - public Color AnimatorColor3 = new Color(0.8f, 0.8f, 0.8f, 0.07f); |
39 | | - public Color AnimatorColor4 = new Color(1f, 1f, 1f, 0.05f); |
40 | | - |
41 | | - public float AnimatorSizeGrow = 0.5f; |
42 | | - |
43 | | - #endregion |
44 | | - |
45 | | - public FSBDparticleFX(GameObject _gameObject, Texture2D _particleTexture) |
46 | | - { |
47 | | - gameObject = _gameObject; |
48 | | - particleTexture = _particleTexture; |
49 | | - } |
50 | | - |
51 | | - private void addComponents() |
52 | | - { |
53 | | - pEmitter = (ParticleEmitter)gameObject.AddComponent(typeof(MeshParticleEmitter)); |
54 | | - pRenderer = gameObject.AddComponent<ParticleRenderer>(); |
55 | | - pAnimator = gameObject.AddComponent<ParticleAnimator>(); |
56 | | - } |
57 | | - |
58 | | - public void setupFXValues() |
59 | | - { |
60 | | - if (!componentsAdded) |
61 | | - { |
62 | | - addComponents(); |
63 | | - componentsAdded = true; |
64 | | - } |
65 | | - pRenderer.materials = new Material[1]; |
66 | | - pRenderer.materials[0].shader = Shader.Find(RendererShader); |
67 | | - pRenderer.materials[0].mainTexture = particleTexture; |
68 | | - |
69 | | - pEmitter.minSize = EmitterMinSize; |
70 | | - pEmitter.maxSize = EmitterMaxSize; |
71 | | - pEmitter.minEnergy = EmitterMinEnergy; |
72 | | - pEmitter.maxEnergy = EmitterMaxEnergy; |
73 | | - pEmitter.minEmission = EmitterMinEmission; |
74 | | - pEmitter.maxEmission = EmitterMaxEmission; |
75 | | - pEmitter.localVelocity = EmitterLocalVelocity; |
76 | | - pEmitter.rndVelocity = EmitterRndVelocity; |
77 | | - pEmitter.useWorldSpace = EmitterUseWorldSpace; |
78 | | - |
79 | | - pAnimator.doesAnimateColor = AnimatorDoesAnimateColor; |
80 | | - |
81 | | - Color[] colorAnimation = pAnimator.colorAnimation; |
82 | | - colorAnimation[0] = AnimatorColor0; |
83 | | - colorAnimation[1] = AnimatorColor1; |
84 | | - colorAnimation[2] = AnimatorColor2; |
85 | | - colorAnimation[3] = AnimatorColor3; |
86 | | - colorAnimation[4] = AnimatorColor4; |
87 | | - pAnimator.colorAnimation = colorAnimation; |
88 | | - |
89 | | - pAnimator.sizeGrow = AnimatorSizeGrow; |
90 | | - } |
91 | | - |
92 | | - public void updateFX() |
93 | | - { |
| 3 | +namespace Firespitter |
| 4 | +{ |
| 5 | + //RBP - Deprecating this due to particle system changes. |
| 6 | + public class FSBDparticleFX |
| 7 | + { |
| 8 | + |
| 9 | + //public GameObject gameObject; |
| 10 | + //public GameObject parentObject; |
| 11 | + //public Texture particleTexture; |
| 12 | + //public bool useLocalSpaceVelocityHack = false; |
| 13 | + |
| 14 | + //public ParticleEmitter pEmitter; |
| 15 | + //public ParticleRenderer pRenderer; |
| 16 | + //public ParticleAnimator pAnimator; |
| 17 | + |
| 18 | + //private bool componentsAdded = false; |
| 19 | + |
| 20 | + //#region component variables |
| 21 | + |
| 22 | + //public string RendererShader = "Particles/Alpha Blended"; |
| 23 | + |
| 24 | + //public float EmitterMinSize = 0.1f; |
| 25 | + //public float EmitterMaxSize = 0.2f; |
| 26 | + //public float EmitterMinEnergy = 0.1f; |
| 27 | + //public float EmitterMaxEnergy = 0.8f; |
| 28 | + //public float EmitterMinEmission = 120f; |
| 29 | + //public float EmitterMaxEmission = 160f; |
| 30 | + //public Vector3 EmitterLocalVelocity = new Vector3(0f, 0f, 1f); |
| 31 | + //public Vector3 EmitterRndVelocity = new Vector3(0f, 0.1f, 0.1f); |
| 32 | + //public bool EmitterUseWorldSpace = true; |
| 33 | + //public bool EmitterRandomRotation = true; |
| 34 | + |
| 35 | + //public bool AnimatorDoesAnimateColor = true; |
| 36 | + |
| 37 | + //public Color AnimatorColor0 = new Color(0.2f, 0.2f, 0.2f, 0.1f); |
| 38 | + //public Color AnimatorColor1 = new Color(0.3f, 0.3f, 0.3f, 0.1f); |
| 39 | + //public Color AnimatorColor2 = new Color(0.5f, 0.5f, 0.5f, 0.09f); |
| 40 | + //public Color AnimatorColor3 = new Color(0.8f, 0.8f, 0.8f, 0.07f); |
| 41 | + //public Color AnimatorColor4 = new Color(1f, 1f, 1f, 0.05f); |
| 42 | + |
| 43 | + //public float AnimatorSizeGrow = 0.5f; |
| 44 | + |
| 45 | + //#endregion |
| 46 | + |
| 47 | + //public FSBDparticleFX(GameObject _gameObject, Texture2D _particleTexture) |
| 48 | + //{ |
| 49 | + // gameObject = _gameObject; |
| 50 | + // particleTexture = _particleTexture; |
| 51 | + //} |
| 52 | + |
| 53 | + //private void addComponents() |
| 54 | + //{ |
| 55 | + // pEmitter = gameObject.AddComponent<MeshParticleEmitter>(); |
| 56 | + // pRenderer = gameObject.AddComponent<ParticleRenderer>(); |
| 57 | + // pAnimator = gameObject.AddComponent<ParticleAnimator>(); |
| 58 | + //} |
94 | 59 |
|
95 | | - if (useLocalSpaceVelocityHack) |
96 | | - { |
97 | | - //float velMagnitude = parentObject.rigidbody.velocity.magnitude; |
98 | | - float fxSpeed = Vector3.Dot(gameObject.transform.forward, parentObject.GetComponent<Rigidbody>().velocity); |
99 | | - if (fxSpeed > 0f) |
100 | | - fxSpeed = 0; |
101 | | - pEmitter.localVelocity = new Vector3(0f, 0f, 1f + (-fxSpeed * 0.1f)); |
102 | | - //pEmitter.maxEmission = pEmitter.minEmission + (velMagnitude * 3); |
103 | | - } |
| 60 | + //public void setupFXValues() |
| 61 | + //{ |
| 62 | + // if (!componentsAdded) |
| 63 | + // { |
| 64 | + // addComponents(); |
| 65 | + // componentsAdded = true; |
| 66 | + // } |
| 67 | + // pRenderer.materials = new Material[1]; |
| 68 | + // pRenderer.materials[0].shader = Shader.Find(RendererShader); |
| 69 | + // pRenderer.materials[0].mainTexture = particleTexture; |
| 70 | + |
| 71 | + // pEmitter.minSize = EmitterMinSize; |
| 72 | + // pEmitter.maxSize = EmitterMaxSize; |
| 73 | + // pEmitter.minEnergy = EmitterMinEnergy; |
| 74 | + // pEmitter.maxEnergy = EmitterMaxEnergy; |
| 75 | + // pEmitter.minEmission = EmitterMinEmission; |
| 76 | + // pEmitter.maxEmission = EmitterMaxEmission; |
| 77 | + // pEmitter.localVelocity = EmitterLocalVelocity; |
| 78 | + // pEmitter.rndVelocity = EmitterRndVelocity; |
| 79 | + // pEmitter.useWorldSpace = EmitterUseWorldSpace; |
| 80 | + |
| 81 | + // pAnimator.doesAnimateColor = AnimatorDoesAnimateColor; |
| 82 | + |
| 83 | + // Color[] colorAnimation = pAnimator.colorAnimation; |
| 84 | + // colorAnimation[0] = AnimatorColor0; |
| 85 | + // colorAnimation[1] = AnimatorColor1; |
| 86 | + // colorAnimation[2] = AnimatorColor2; |
| 87 | + // colorAnimation[3] = AnimatorColor3; |
| 88 | + // colorAnimation[4] = AnimatorColor4; |
| 89 | + // pAnimator.colorAnimation = colorAnimation; |
| 90 | + |
| 91 | + // pAnimator.sizeGrow = AnimatorSizeGrow; |
| 92 | + //} |
104 | 93 |
|
105 | | - |
106 | | - |
107 | | - } |
| 94 | + //public void updateFX() |
| 95 | + //{ |
| 96 | + |
| 97 | + // if (useLocalSpaceVelocityHack) |
| 98 | + // { |
| 99 | + // //float velMagnitude = parentObject.GetComponent<Rigidbody>().velocity.magnitude; |
| 100 | + // float fxSpeed = Vector3.Dot(gameObject.transform.forward, parentObject.GetComponent<Rigidbody>().velocity); |
| 101 | + // if (fxSpeed > 0f) |
| 102 | + // fxSpeed = 0; |
| 103 | + // pEmitter.localVelocity = new Vector3(0f, 0f, 1f + (-fxSpeed * 0.1f)); |
| 104 | + // //pEmitter.maxEmission = pEmitter.minEmission + (velMagnitude * 3); |
| 105 | + // } |
| 106 | + //} |
108 | 107 |
|
| 108 | + } |
109 | 109 | } |
0 commit comments