Created
March 31, 2020 05:43
-
-
Save drecom-sgt/05748e6c4cb9c18495c5f8436eb9a9ae to your computer and use it in GitHub Desktop.
Tech Inside Drecom で Unity バージョン移行に関する記事のネタ
This file contains hidden or 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
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcController.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcController.cs | |
index 098d80e5a6..a633112a4f 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcController.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcController.cs | |
@@ -110,10 +110,10 @@ public class NcController : NcEffectBehaviour | |
for (int i = 0; i < nca.Length; ++i) { | |
nca [i].m_bAutoDestruct = !isDontDestroy; | |
} | |
- var pa = gameObject.GetComponentsInChildren<ParticleAnimator> (true); | |
- for (int i = 0; i < pa.Length; ++i) { | |
- pa [i].autodestruct = !isDontDestroy; | |
- } | |
+// var pa = gameObject.GetComponentsInChildren<ParticleAnimator> (true); | |
+// for (int i = 0; i < pa.Length; ++i) { | |
+// pa [i].autodestruct = !isDontDestroy; | |
+// } | |
var sa = gameObject.GetComponentsInChildren<NcSpriteAnimation> (true); | |
for (int i = 0; i < sa.Length; ++i) { | |
sa [i].m_bAutoDestruct = !isDontDestroy; | |
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcEffectBehaviour.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcEffectBehaviour.cs | |
index d49f9193f9..09b141079b 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcEffectBehaviour.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NcEffectBehaviour.cs | |
@@ -249,10 +249,10 @@ public class NcEffectBehaviour : MonoBehaviour | |
ParticleSystem.EmissionModule emm = em.emission; | |
emm.enabled = false; | |
} | |
- ParticleEmitter[] pes = gameObject.GetComponentsInChildren<ParticleEmitter>(true); | |
- foreach (ParticleEmitter em in pes) | |
- if (em != null) | |
- em.emit = false; | |
+// ParticleEmitter[] pes = gameObject.GetComponentsInChildren<ParticleEmitter>(true); | |
+// foreach (ParticleEmitter em in pes) | |
+// if (em != null) | |
+// em.emit = false; | |
} | |
// SafeCreate ----------------------------------------------------------------------------------- | |
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NsSharedManager.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NsSharedManager.cs | |
index 7fb2f1a70d..eb6cadeaf9 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NsSharedManager.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/Common/NsSharedManager.cs | |
@@ -56,14 +56,14 @@ public class NsSharedManager : MonoBehaviour | |
NcParticleSystem ps = sharedObj.GetComponent<NcParticleSystem>(); | |
if (ps) | |
ps.enabled = false; | |
- if (sharedObj.GetComponent<ParticleEmitter>()) | |
- { | |
- sharedObj.GetComponent<ParticleEmitter>().emit = false; | |
- sharedObj.GetComponent<ParticleEmitter>().useWorldSpace = true; | |
- ParticleAnimator paAni = sharedObj.GetComponent<ParticleAnimator>(); | |
- if (paAni) | |
- paAni.autodestruct = false; | |
- } | |
+// if (sharedObj.GetComponent<ParticleEmitter>()) | |
+// { | |
+// sharedObj.GetComponent<ParticleEmitter>().emit = false; | |
+// sharedObj.GetComponent<ParticleEmitter>().useWorldSpace = true; | |
+// ParticleAnimator paAni = sharedObj.GetComponent<ParticleAnimator>(); | |
+// if (paAni) | |
+// paAni.autodestruct = false; | |
+// } | |
NcParticleSystem ncPsCom = sharedObj.GetComponent<NcParticleSystem>(); | |
if (ncPsCom) | |
ncPsCom.m_bBurst = false; | |
@@ -86,13 +86,13 @@ public class NsSharedManager : MonoBehaviour | |
if (sharedObj == null) | |
return; | |
sharedObj.transform.position = worldPos; | |
- if (sharedObj.GetComponent<ParticleEmitter>() != null) | |
- sharedObj.GetComponent<ParticleEmitter>().Emit(nEmitCount); | |
- else { | |
+// if (sharedObj.GetComponent<ParticleEmitter>() != null) | |
+// sharedObj.GetComponent<ParticleEmitter>().Emit(nEmitCount); | |
+// else { | |
ParticleSystem ps = sharedObj.GetComponent<ParticleSystem>(); | |
if (ps != null) | |
ps.Emit(nEmitCount); | |
- } | |
+// } | |
} | |
// AudioSource | |
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleEmit.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleEmit.cs | |
index df1a236827..db506259f1 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleEmit.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleEmit.cs | |
@@ -35,7 +35,8 @@ public class NcParticleEmit : NcEffectBehaviour | |
#if UNITY_EDITOR | |
public override string CheckProperty() | |
{ | |
- if (m_ParticlePrefab == null || (m_ParticlePrefab.GetComponent<ParticleEmitter>() == null && m_ParticlePrefab.GetComponent<ParticleSystem>() == null)) | |
+// if (m_ParticlePrefab == null || (m_ParticlePrefab.GetComponent<ParticleEmitter>() == null && m_ParticlePrefab.GetComponent<ParticleSystem>() == null)) | |
+ if (m_ParticlePrefab == null) | |
return "SCRIPT_EMPTY_PARTICLEPREFAB"; | |
return ""; // no error | |
} | |
@@ -159,15 +160,15 @@ public class NcParticleEmit : NcEffectBehaviour | |
// PrefabAdjustSpeed - unsupported | |
// m_bDetachParent - unsupported | |
- if (m_CreateGameObject.GetComponent<ParticleEmitter>() != null) | |
- m_CreateGameObject.GetComponent<ParticleEmitter>().Emit(m_EmitCount); | |
+// if (m_CreateGameObject.GetComponent<ParticleEmitter>() != null) | |
+// m_CreateGameObject.GetComponent<ParticleEmitter>().Emit(m_EmitCount); | |
// m_CreateGameObject.particleEmitter.Emit(newPos, Vector3.zero, 1, 1, Color.white); | |
- else { | |
+// else { | |
if (m_ps == null) | |
m_ps = m_CreateGameObject.GetComponent<ParticleSystem>(); | |
if (m_ps != null) | |
m_ps.Emit(m_EmitCount); | |
- } | |
+// } | |
return m_CreateGameObject; | |
} | |
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSpiral.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSpiral.cs | |
index 9ca2e71fb3..6a843d2769 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSpiral.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSpiral.cs | |
@@ -163,7 +163,8 @@ public class NcParticleSpiral : NcEffectBehaviour | |
#if UNITY_EDITOR | |
public override string CheckProperty() | |
{ | |
- if ((m_ParticlePrefab == null || m_ParticlePrefab.GetComponent<ParticleEmitter>() == null) && (GetComponent<ParticleEmitter>() == null)) | |
+// if ((m_ParticlePrefab == null || m_ParticlePrefab.GetComponent<ParticleEmitter>() == null) && (GetComponent<ParticleEmitter>() == null)) | |
+ if (m_ParticlePrefab == null) | |
return "SCRIPT_EMPTY_LEGACYPARTICLEPREFAB"; | |
return ""; // no error | |
} | |
@@ -200,10 +201,10 @@ public class NcParticleSpiral : NcEffectBehaviour | |
if (m_ParticlePrefab == null) | |
{ | |
- ParticleEmitter emitter = GetComponent<ParticleEmitter>(); | |
- if (emitter == null) | |
+// ParticleEmitter emitter = GetComponent<ParticleEmitter>(); | |
+// if (emitter == null) | |
return; | |
- emitter.emit = false; | |
+// emitter.emit = false; | |
} | |
// Record the current Inspector settings as the defaults. | |
@@ -230,83 +231,83 @@ public class NcParticleSpiral : NcEffectBehaviour | |
effectObject = gameObject; | |
} | |
- // Get the particle emitter from the new effect object. | |
- ParticleEmitter emitter = effectObject.GetComponent<ParticleEmitter>(); | |
- if (emitter == null) | |
- return; | |
- | |
- emitter.emit = false; | |
- emitter.useWorldSpace = false; | |
- | |
- // Make sure autodestruct is on so that dead particles systems get destroyed. | |
- ParticleAnimator animator = emitter.transform.GetComponent<ParticleAnimator>(); | |
- if (animator != null) | |
- animator.autodestruct = true; | |
- | |
- // Generate the particles. | |
- emitter.Emit(m_nNumberOfArms * m_nParticlesPerArm); | |
- | |
- // Extract the particles from the created emitter. | |
- Particle[] p = emitter.particles; | |
- | |
- // The rotation angle, in radians, between the arms of the spiral. | |
- float armSpacing = (2 * Mathf.PI) / m_nNumberOfArms; | |
- | |
- // Loop thru the arms... | |
- for (int j=0; j<m_nNumberOfArms; j++) | |
- { | |
- float r = 0; | |
- float theta = 0; | |
- float armRotation = j*armSpacing; | |
- | |
- // Loop thru the particles for this arm and place them. | |
- for (int i = 0; i < m_nParticlesPerArm; i++) | |
- { | |
- // This particle's index. | |
- int pX = j * m_nParticlesPerArm + i; | |
- | |
- // This is the equation for our spiral in polar coords.... | |
- r = m_fOriginOffset + m_fTurnDistance * theta; | |
- | |
- // All particles are positioned wrt the local transform origin. | |
- Vector3 newPos = effectObject.transform.localPosition; | |
- //Vector3 newPos = effectObject.position; | |
- | |
- // Convert to Cartesian coords... | |
- newPos.x = newPos.x + r * Mathf.Cos(theta); | |
- newPos.z = newPos.z + r * Mathf.Sin(theta); | |
- | |
- // Rotate the particle about the origin to our desired position for this arm. | |
- float x = newPos.x * Mathf.Cos(armRotation) + newPos.z * Mathf.Sin(armRotation); | |
- float z = -newPos.x * Mathf.Sin(armRotation) + newPos.z * Mathf.Cos(armRotation); | |
- newPos.x = x; | |
- newPos.z = z; | |
- | |
- // Introduce the desired vertical offset. | |
- newPos.y = newPos.y + i * m_fVerticalTurnDistance; | |
- | |
- // Update the particle position. | |
- if (emitter.useWorldSpace) | |
- newPos = transform.TransformPoint(newPos); | |
- p[pX].position = newPos; | |
- | |
- // Bump to our next point on the curve. | |
- theta += m_fParticleSeparation; | |
- | |
- // Set particle lifetime to account for specified fade. | |
-// p[pX].energy = p[pX].energy - i * m_fFadeValue; | |
- if (m_fFadeValue != 0) | |
- p[pX].energy = p[pX].energy * (1 - Mathf.Abs(m_fFadeValue)) + p[pX].energy * Mathf.Abs(m_fFadeValue) * (m_fFadeValue < 0 ? m_nParticlesPerArm-i : i+1) / m_nParticlesPerArm; | |
- | |
- // Set particle size to account for specified variation. | |
-// p[pX].size = p[pX].size - i * m_fSizeValue; | |
- if (m_fSizeValue != 0) | |
- p[pX].size += Mathf.Abs(m_fSizeValue) * (m_fSizeValue < 0 ? m_nParticlesPerArm-i : i+1) / m_nParticlesPerArm; | |
- | |
- } | |
- } | |
- // Update the actual particles. | |
- emitter.particles = p; | |
+// // Get the particle emitter from the new effect object. | |
+// ParticleEmitter emitter = effectObject.GetComponent<ParticleEmitter>(); | |
+// if (emitter == null) | |
+// return; | |
+// | |
+// emitter.emit = false; | |
+// emitter.useWorldSpace = false; | |
+// | |
+// // Make sure autodestruct is on so that dead particles systems get destroyed. | |
+// ParticleAnimator animator = emitter.transform.GetComponent<ParticleAnimator>(); | |
+// if (animator != null) | |
+// animator.autodestruct = true; | |
+// | |
+// // Generate the particles. | |
+// emitter.Emit(m_nNumberOfArms * m_nParticlesPerArm); | |
+// | |
+// // Extract the particles from the created emitter. | |
+// Particle[] p = emitter.particles; | |
+// | |
+// // The rotation angle, in radians, between the arms of the spiral. | |
+// float armSpacing = (2 * Mathf.PI) / m_nNumberOfArms; | |
+// | |
+// // Loop thru the arms... | |
+// for (int j=0; j<m_nNumberOfArms; j++) | |
+// { | |
+// float r = 0; | |
+// float theta = 0; | |
+// float armRotation = j*armSpacing; | |
+// | |
+// // Loop thru the particles for this arm and place them. | |
+// for (int i = 0; i < m_nParticlesPerArm; i++) | |
+// { | |
+// // This particle's index. | |
+// int pX = j * m_nParticlesPerArm + i; | |
+// | |
+// // This is the equation for our spiral in polar coords.... | |
+// r = m_fOriginOffset + m_fTurnDistance * theta; | |
+// | |
+// // All particles are positioned wrt the local transform origin. | |
+// Vector3 newPos = effectObject.transform.localPosition; | |
+// //Vector3 newPos = effectObject.position; | |
+// | |
+// // Convert to Cartesian coords... | |
+// newPos.x = newPos.x + r * Mathf.Cos(theta); | |
+// newPos.z = newPos.z + r * Mathf.Sin(theta); | |
+// | |
+// // Rotate the particle about the origin to our desired position for this arm. | |
+// float x = newPos.x * Mathf.Cos(armRotation) + newPos.z * Mathf.Sin(armRotation); | |
+// float z = -newPos.x * Mathf.Sin(armRotation) + newPos.z * Mathf.Cos(armRotation); | |
+// newPos.x = x; | |
+// newPos.z = z; | |
+// | |
+// // Introduce the desired vertical offset. | |
+// newPos.y = newPos.y + i * m_fVerticalTurnDistance; | |
+// | |
+// // Update the particle position. | |
+// if (emitter.useWorldSpace) | |
+// newPos = transform.TransformPoint(newPos); | |
+// p[pX].position = newPos; | |
+// | |
+// // Bump to our next point on the curve. | |
+// theta += m_fParticleSeparation; | |
+// | |
+// // Set particle lifetime to account for specified fade. | |
+//// p[pX].energy = p[pX].energy - i * m_fFadeValue; | |
+// if (m_fFadeValue != 0) | |
+// p[pX].energy = p[pX].energy * (1 - Mathf.Abs(m_fFadeValue)) + p[pX].energy * Mathf.Abs(m_fFadeValue) * (m_fFadeValue < 0 ? m_nParticlesPerArm-i : i+1) / m_nParticlesPerArm; | |
+// | |
+// // Set particle size to account for specified variation. | |
+//// p[pX].size = p[pX].size - i * m_fSizeValue; | |
+// if (m_fSizeValue != 0) | |
+// p[pX].size += Mathf.Abs(m_fSizeValue) * (m_fSizeValue < 0 ? m_nParticlesPerArm-i : i+1) / m_nParticlesPerArm; | |
+// | |
+// } | |
+// } | |
+// // Update the actual particles. | |
+// emitter.particles = p; | |
} | |
void Update() | |
@@ -405,25 +406,25 @@ public class NcParticleSpiral : NcEffectBehaviour | |
// Kill all current spawns of the effect. | |
private void killCurrentEffects() | |
{ | |
- // Loop thru the particle emitter children of this object. Each one is a particle effect system | |
- // we want to destroy. | |
- ParticleEmitter[] emitters = this.transform.GetComponentsInChildren<ParticleEmitter>(); | |
- foreach (ParticleEmitter emitter in emitters) | |
- { | |
- Debug.Log("resetEffect killing: " + emitter.name); | |
- // Make sure autodestruct is on. | |
- ParticleAnimator animator = emitter.transform.GetComponent<ParticleAnimator>(); | |
- if (animator != null) | |
- animator.autodestruct = true; | |
- // Now loop thru the particles and set their energies to a small number. The effect will | |
- // subsequently autodestruct. I originally tried setting the energy to zero, but in that | |
- // case they did *not* autodestruct. | |
- // I originally tried simply doing a Destroy on the emitter, but got threatening runtime messages. | |
- Particle[] p = emitter.particles; | |
- for (int i=0; i < p.Length; i++) | |
- p[i].energy = 0.1f; | |
- emitter.particles = p; | |
- } | |
+// // Loop thru the particle emitter children of this object. Each one is a particle effect system | |
+// // we want to destroy. | |
+// ParticleEmitter[] emitters = this.transform.GetComponentsInChildren<ParticleEmitter>(); | |
+// foreach (ParticleEmitter emitter in emitters) | |
+// { | |
+// Debug.Log("resetEffect killing: " + emitter.name); | |
+// // Make sure autodestruct is on. | |
+// ParticleAnimator animator = emitter.transform.GetComponent<ParticleAnimator>(); | |
+// if (animator != null) | |
+// animator.autodestruct = true; | |
+// // Now loop thru the particles and set their energies to a small number. The effect will | |
+// // subsequently autodestruct. I originally tried setting the energy to zero, but in that | |
+// // case they did *not* autodestruct. | |
+// // I originally tried simply doing a Destroy on the emitter, but got threatening runtime messages. | |
+// Particle[] p = emitter.particles; | |
+// for (int i=0; i < p.Length; i++) | |
+// p[i].energy = 0.1f; | |
+// emitter.particles = p; | |
+// } | |
} | |
// Event Function ------------------------------------------------------------------- | |
diff --git a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSystem.cs b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSystem.cs | |
index a35b447138..4803224e98 100644 | |
--- a/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSystem.cs | |
+++ b/Assets/IGSoft_Resources/Scripts/NcEffect/NcParticleSystem.cs | |
@@ -65,9 +65,9 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
protected bool m_bMeshParticleEmitter = false; | |
protected ParticleSystem m_ps; | |
- protected ParticleEmitter m_pe; | |
- protected ParticleAnimator m_pa; | |
- protected ParticleRenderer m_pr; | |
+// protected ParticleEmitter m_pe; | |
+// protected ParticleAnimator m_pa; | |
+// protected ParticleRenderer m_pr; | |
protected ParticleSystem.Particle[] m_BufPsParts; | |
protected ParticleSystem.Particle[] m_BufColliderOriParts; | |
@@ -88,7 +88,8 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
public bool IsLegacy() | |
{ | |
- return GetComponent<ParticleEmitter>() != null && GetComponent<ParticleEmitter>().enabled; | |
+// return GetComponent<ParticleEmitter>() != null && GetComponent<ParticleEmitter>().enabled; | |
+ return false; | |
} | |
#if UNITY_EDITOR | |
@@ -97,7 +98,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
if (1 < gameObject.GetComponents(GetType()).Length) | |
return "SCRIPT_WARRING_DUPLICATE"; | |
- if (GetComponent<ParticleSystem>() == null && GetComponent<ParticleEmitter>() == null) | |
+ if (GetComponent<ParticleSystem>() == null/* && GetComponent<ParticleEmitter>() == null*/) | |
return "SCRIPT_EMPTY_PARTICLE"; | |
// if (m_ParticleDestruct != ParticleDestruct.NONE && m_AttachPrefab == null) | |
@@ -157,8 +158,8 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
m_ps.Play(); | |
} | |
- if (m_pe != null) | |
- m_pe.ClearParticles(); | |
+// if (m_pe != null) | |
+// m_pe.ClearParticles(); | |
} | |
if (m_bBurst || 0 < m_fStartDelayTime) | |
SetEnableParticle(false); | |
@@ -172,14 +173,14 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
if (IsShuriken()) | |
{ | |
m_ps = GetComponent<ParticleSystem>(); | |
- } else { | |
+ }/* else { | |
m_pe = GetComponent<ParticleEmitter>(); | |
m_pa = GetComponent<ParticleAnimator>(); | |
m_pr = GetComponent<ParticleRenderer>(); | |
if (m_pe != null) | |
m_bMeshParticleEmitter = (m_pe.ToString().Contains("MeshParticleEmitter")); | |
- } | |
+ }*/ | |
} | |
void OnEnable() | |
@@ -239,11 +240,11 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
ShurikenInitParticle(); | |
m_fShurikenSpeedRate = base.EffectTimeScale_; | |
} | |
- else | |
- { | |
- LegacyInitParticle(); | |
- m_fStartLifeTimeRate /= base.EffectTimeScale_; | |
- } | |
+// else | |
+// { | |
+// LegacyInitParticle(); | |
+// m_fStartLifeTimeRate /= base.EffectTimeScale_; | |
+// } | |
if (m_bBurst || 0 < m_fStartDelayTime) | |
SetEnableParticle(false); | |
@@ -261,11 +262,11 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
m_ps.playbackSpeed = base.EffectTimeScale_; | |
m_fShurikenSpeedRate = base.EffectTimeScale_; | |
} | |
- else | |
- { | |
- m_fStartLifeTimeRate /= base.EffectTimeScale_; | |
- LegacyParticleSpeed(base.EffectTimeScale_); | |
- } | |
+// else | |
+// { | |
+// m_fStartLifeTimeRate /= base.EffectTimeScale_; | |
+// LegacyParticleSpeed(base.EffectTimeScale_); | |
+// } | |
if (m_fEmitStartTime == 0) | |
{ | |
@@ -297,7 +298,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
m_nCreateCount++; | |
if (IsShuriken()) | |
m_ps.Emit(m_fBurstEmissionCount); | |
- else if (m_pe != null) m_pe.Emit(m_fBurstEmissionCount); | |
+// else if (m_pe != null) m_pe.Emit(m_fBurstEmissionCount); | |
} | |
} else { | |
// SetEnableParticle(false); | |
@@ -380,7 +381,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
if (bUpdate) | |
m_ps.SetParticles(m_BufColliderOriParts, m_ps.particleCount); | |
} | |
- } else { | |
+ }/* else { | |
if (m_pe != null) | |
{ | |
Particle[] oriParts = m_pe.particles; | |
@@ -424,7 +425,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
if (bUpdate) | |
m_pe.particles = oriParts; | |
} | |
- } | |
+ }*/ | |
} | |
} | |
@@ -437,7 +438,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
m_bScalePreRender = true; | |
if (IsShuriken()) | |
ShurikenSetRuntimeParticleScale(true); | |
- else LegacySetRuntimeParticleScale(true); | |
+// else LegacySetRuntimeParticleScale(true); | |
} | |
} | |
@@ -449,7 +450,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
{ | |
if (IsShuriken()) | |
ShurikenSetRuntimeParticleScale(false); | |
- else LegacySetRuntimeParticleScale(false); | |
+// else LegacySetRuntimeParticleScale(false); | |
} | |
m_OldPos = transform.position; | |
m_bScalePreRender = false; | |
@@ -509,16 +510,16 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
ParticleSystem.EmissionModule em = m_ps.emission; | |
em.enabled = bEnable; | |
} | |
- if (m_pe != null) | |
- m_pe.emit = bEnable; | |
+// if (m_pe != null) | |
+// m_pe.emit = bEnable; | |
} | |
void ClearParticle() | |
{ | |
if (m_ps != null) | |
m_ps.Clear(false); | |
- if (m_pe != null) | |
- m_pe.ClearParticles(); | |
+// if (m_pe != null) | |
+// m_pe.ClearParticles(); | |
} | |
// Legacy ---------------------------------------------------------- | |
@@ -532,160 +533,160 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
return m_fLegacyMaxMeshNormalVelocity * (m_bScaleWithTransform ? NcTransformTool.GetTransformScaleMeanValue(transform) : 1); | |
} | |
- void LegacyInitParticle() | |
- { | |
- if (m_pe != null) | |
- LegacySetParticle(); | |
- } | |
- | |
- void LegacySetParticle() | |
- { | |
- ParticleEmitter pe = m_pe; | |
- ParticleAnimator pa = m_pa; | |
- ParticleRenderer pr = m_pr; | |
- | |
- if (pe == null || pr == null) | |
- return; | |
- | |
- if (m_bLegacyRuntimeScale) | |
- { | |
- Vector3 vecVelScale = Vector3.one * m_fStartSpeedRate; | |
- float fVelScale = m_fStartSpeedRate; | |
- | |
- pe.minSize *= m_fStartSizeRate; | |
- pe.maxSize *= m_fStartSizeRate; | |
- pe.minEnergy *= m_fStartLifeTimeRate; | |
- pe.maxEnergy *= m_fStartLifeTimeRate; | |
- pe.minEmission *= m_fStartEmissionRate; | |
- pe.maxEmission *= m_fStartEmissionRate; | |
- | |
- pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecVelScale); | |
- pe.localVelocity = Vector3.Scale(pe.localVelocity, vecVelScale); | |
- pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecVelScale); | |
- pe.angularVelocity *= fVelScale; | |
- pe.rndAngularVelocity *= fVelScale; | |
- pe.emitterVelocityScale *= fVelScale; | |
- | |
-// NgAssembly.LogFieldsPropertis(pe); | |
- | |
- if (pa != null) | |
- { | |
- pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale); | |
- pa.force = Vector3.Scale(pa.force, vecVelScale); | |
-// pa.damping *= fScale; | |
- } | |
- | |
-// pr.velocityScale *= fVelScale; | |
- pr.lengthScale *= m_fRenderLengthRate; | |
- } else { | |
- Vector3 vecVelScale = (m_bScaleWithTransform ? pe.transform.lossyScale : Vector3.one) * m_fStartSpeedRate; | |
- float fVelScale = (m_bScaleWithTransform ? NcTransformTool.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSpeedRate; | |
- float fScale = (m_bScaleWithTransform ? NcTransformTool.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSizeRate; | |
- | |
- pe.minSize *= fScale; | |
- pe.maxSize *= fScale; | |
- pe.minEnergy *= m_fStartLifeTimeRate; | |
- pe.maxEnergy *= m_fStartLifeTimeRate; | |
- pe.minEmission *= m_fStartEmissionRate; | |
- pe.maxEmission *= m_fStartEmissionRate; | |
- | |
- pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecVelScale); | |
- pe.localVelocity = Vector3.Scale(pe.localVelocity, vecVelScale); | |
- pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecVelScale); | |
- pe.angularVelocity *= fVelScale; | |
- pe.rndAngularVelocity *= fVelScale; | |
- pe.emitterVelocityScale *= fVelScale; | |
- | |
-// NgAssembly.LogFieldsPropertis(pe); | |
- | |
- if (pa != null) | |
- { | |
- pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale); | |
- pa.force = Vector3.Scale(pa.force, vecVelScale); | |
-// pa.damping *= fScale; | |
- } | |
- | |
-// pr.velocityScale *= fVelScale; | |
- pr.lengthScale *= m_fRenderLengthRate; | |
- } | |
- } | |
- | |
- void LegacyParticleSpeed(float fSpeed) | |
- { | |
- ParticleEmitter pe = m_pe; | |
- ParticleAnimator pa = m_pa; | |
- ParticleRenderer pr = m_pr; | |
- | |
- if (pe == null || pr == null) | |
- return; | |
- | |
- Vector3 vecSpeed = Vector3.one * fSpeed; | |
- | |
- pe.minEnergy /= fSpeed; | |
- pe.maxEnergy /= fSpeed; | |
+// void LegacyInitParticle() | |
+// { | |
+// if (m_pe != null) | |
+// LegacySetParticle(); | |
+// } | |
- pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecSpeed); | |
- pe.localVelocity = Vector3.Scale(pe.localVelocity, vecSpeed); | |
- pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecSpeed); | |
- pe.angularVelocity *= fSpeed; | |
- pe.rndAngularVelocity *= fSpeed; | |
- pe.emitterVelocityScale *= fSpeed; | |
- | |
- if (pa != null) | |
- { | |
- pa.rndForce = Vector3.Scale(pa.rndForce, vecSpeed); | |
- pa.force = Vector3.Scale(pa.force, vecSpeed); | |
-// pa.damping *= fScale; | |
- } | |
-// pr.velocityScale *= fSpeed; | |
- } | |
- | |
- // Runtime Scale ---------------------------------------------- | |
- void LegacySetRuntimeParticleScale(bool bScale) | |
- { | |
- if (m_bLegacyRuntimeScale == false) | |
- return; | |
- | |
- if (m_pe != null) | |
- { | |
- Particle[] parts = m_pe.particles; | |
- m_pe.particles = LegacyScaleParticle(parts, bScale, true); | |
- } | |
- } | |
- | |
- public Particle[] LegacyScaleParticle(Particle[] parts, bool bScale, bool bPosUpdate) | |
- { | |
- float fScale; | |
- | |
- if (bScale) | |
- fScale = NcTransformTool.GetTransformScaleMeanValue(transform); | |
- else fScale = 1 / NcTransformTool.GetTransformScaleMeanValue(transform); | |
- | |
- for (int n = 0; n < parts.Length; n++) | |
- { | |
- if (IsMeshParticleEmitter() == false) | |
- { | |
- if (m_bWorldSpace) | |
- { | |
- if (bPosUpdate) | |
- { | |
- Vector3 move = (m_OldPos - transform.position); | |
- if (bScale) | |
- parts[n].position -= move * (1 - 1/fScale); | |
- } | |
- parts[n].position -= transform.position; | |
- parts[n].position *= fScale; | |
- parts[n].position += transform.position; | |
- } else { | |
- parts[n].position *= fScale; | |
- } | |
- } | |
- parts[n].angularVelocity *= fScale; | |
- parts[n].velocity *= fScale; | |
- parts[n].size *= fScale; | |
- } | |
- return parts; | |
- } | |
+// void LegacySetParticle() | |
+// { | |
+// ParticleEmitter pe = m_pe; | |
+// ParticleAnimator pa = m_pa; | |
+// ParticleRenderer pr = m_pr; | |
+// | |
+// if (pe == null || pr == null) | |
+// return; | |
+// | |
+// if (m_bLegacyRuntimeScale) | |
+// { | |
+// Vector3 vecVelScale = Vector3.one * m_fStartSpeedRate; | |
+// float fVelScale = m_fStartSpeedRate; | |
+// | |
+// pe.minSize *= m_fStartSizeRate; | |
+// pe.maxSize *= m_fStartSizeRate; | |
+// pe.minEnergy *= m_fStartLifeTimeRate; | |
+// pe.maxEnergy *= m_fStartLifeTimeRate; | |
+// pe.minEmission *= m_fStartEmissionRate; | |
+// pe.maxEmission *= m_fStartEmissionRate; | |
+// | |
+// pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecVelScale); | |
+// pe.localVelocity = Vector3.Scale(pe.localVelocity, vecVelScale); | |
+// pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecVelScale); | |
+// pe.angularVelocity *= fVelScale; | |
+// pe.rndAngularVelocity *= fVelScale; | |
+// pe.emitterVelocityScale *= fVelScale; | |
+// | |
+//// NgAssembly.LogFieldsPropertis(pe); | |
+// | |
+// if (pa != null) | |
+// { | |
+// pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale); | |
+// pa.force = Vector3.Scale(pa.force, vecVelScale); | |
+//// pa.damping *= fScale; | |
+// } | |
+// | |
+//// pr.velocityScale *= fVelScale; | |
+// pr.lengthScale *= m_fRenderLengthRate; | |
+// } else { | |
+// Vector3 vecVelScale = (m_bScaleWithTransform ? pe.transform.lossyScale : Vector3.one) * m_fStartSpeedRate; | |
+// float fVelScale = (m_bScaleWithTransform ? NcTransformTool.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSpeedRate; | |
+// float fScale = (m_bScaleWithTransform ? NcTransformTool.GetTransformScaleMeanValue(pe.transform) : 1) * m_fStartSizeRate; | |
+// | |
+// pe.minSize *= fScale; | |
+// pe.maxSize *= fScale; | |
+// pe.minEnergy *= m_fStartLifeTimeRate; | |
+// pe.maxEnergy *= m_fStartLifeTimeRate; | |
+// pe.minEmission *= m_fStartEmissionRate; | |
+// pe.maxEmission *= m_fStartEmissionRate; | |
+// | |
+// pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecVelScale); | |
+// pe.localVelocity = Vector3.Scale(pe.localVelocity, vecVelScale); | |
+// pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecVelScale); | |
+// pe.angularVelocity *= fVelScale; | |
+// pe.rndAngularVelocity *= fVelScale; | |
+// pe.emitterVelocityScale *= fVelScale; | |
+// | |
+//// NgAssembly.LogFieldsPropertis(pe); | |
+// | |
+// if (pa != null) | |
+// { | |
+// pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale); | |
+// pa.force = Vector3.Scale(pa.force, vecVelScale); | |
+//// pa.damping *= fScale; | |
+// } | |
+// | |
+//// pr.velocityScale *= fVelScale; | |
+// pr.lengthScale *= m_fRenderLengthRate; | |
+// } | |
+// } | |
+// | |
+// void LegacyParticleSpeed(float fSpeed) | |
+// { | |
+// ParticleEmitter pe = m_pe; | |
+// ParticleAnimator pa = m_pa; | |
+// ParticleRenderer pr = m_pr; | |
+// | |
+// if (pe == null || pr == null) | |
+// return; | |
+// | |
+// Vector3 vecSpeed = Vector3.one * fSpeed; | |
+// | |
+// pe.minEnergy /= fSpeed; | |
+// pe.maxEnergy /= fSpeed; | |
+// | |
+// pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecSpeed); | |
+// pe.localVelocity = Vector3.Scale(pe.localVelocity, vecSpeed); | |
+// pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecSpeed); | |
+// pe.angularVelocity *= fSpeed; | |
+// pe.rndAngularVelocity *= fSpeed; | |
+// pe.emitterVelocityScale *= fSpeed; | |
+// | |
+// if (pa != null) | |
+// { | |
+// pa.rndForce = Vector3.Scale(pa.rndForce, vecSpeed); | |
+// pa.force = Vector3.Scale(pa.force, vecSpeed); | |
+//// pa.damping *= fScale; | |
+// } | |
+//// pr.velocityScale *= fSpeed; | |
+// } | |
+// | |
+// // Runtime Scale ---------------------------------------------- | |
+// void LegacySetRuntimeParticleScale(bool bScale) | |
+// { | |
+// if (m_bLegacyRuntimeScale == false) | |
+// return; | |
+// | |
+// if (m_pe != null) | |
+// { | |
+// Particle[] parts = m_pe.particles; | |
+// m_pe.particles = LegacyScaleParticle(parts, bScale, true); | |
+// } | |
+// } | |
+// | |
+// public Particle[] LegacyScaleParticle(Particle[] parts, bool bScale, bool bPosUpdate) | |
+// { | |
+// float fScale; | |
+// | |
+// if (bScale) | |
+// fScale = NcTransformTool.GetTransformScaleMeanValue(transform); | |
+// else fScale = 1 / NcTransformTool.GetTransformScaleMeanValue(transform); | |
+// | |
+// for (int n = 0; n < parts.Length; n++) | |
+// { | |
+// if (IsMeshParticleEmitter() == false) | |
+// { | |
+// if (m_bWorldSpace) | |
+// { | |
+// if (bPosUpdate) | |
+// { | |
+// Vector3 move = (m_OldPos - transform.position); | |
+// if (bScale) | |
+// parts[n].position -= move * (1 - 1/fScale); | |
+// } | |
+// parts[n].position -= transform.position; | |
+// parts[n].position *= fScale; | |
+// parts[n].position += transform.position; | |
+// } else { | |
+// parts[n].position *= fScale; | |
+// } | |
+// } | |
+// parts[n].angularVelocity *= fScale; | |
+// parts[n].velocity *= fScale; | |
+// parts[n].size *= fScale; | |
+// } | |
+// return parts; | |
+// } | |
// Shuriken --------------------------------------------------------------------------- | |
void ShurikenInitParticle() | |
@@ -766,7 +767,7 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
m_fEmitTime /= fSpeedRate; | |
m_fSleepTime /= fSpeedRate; | |
m_fShurikenSpeedRate *= fSpeedRate; | |
- LegacyParticleSpeed(fSpeedRate); | |
+// LegacyParticleSpeed(fSpeedRate); | |
// m_fStartLifeTimeRate = 1; | |
// m_fStartEmissionRate = 1; | |
// m_fStartSpeedRate = 1; | |
@@ -783,10 +784,10 @@ public class NcParticleSystem : NcEffectBehaviour,RenderEventReceiver | |
public override void OnSetReplayState() | |
{ | |
base.OnSetReplayState(); | |
- m_pe = GetComponent<ParticleEmitter>(); | |
- m_pa = GetComponent<ParticleAnimator>(); | |
- if (m_pa != null) | |
- m_pa.autodestruct = false; | |
+// m_pe = GetComponent<ParticleEmitter>(); | |
+// m_pa = GetComponent<ParticleAnimator>(); | |
+// if (m_pa != null) | |
+// m_pa.autodestruct = false; | |
} | |
public override void OnResetReplayStage(bool bClearOldParticle)``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment