1132 lines
44 KiB
C#
1132 lines
44 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER
|
|
{
|
|
[ExecuteInEditMode]
|
|
public class AttractParticlesSKYMASTER : MonoBehaviour
|
|
{
|
|
public bool Turbulance;
|
|
|
|
public float Turbulance_strength = 0.1f;
|
|
|
|
public float Turbulance_frequency = 0.1f;
|
|
|
|
public Vector3 Axis_affected = new Vector3(0f, 1f, 0f);
|
|
|
|
public bool splash_effect;
|
|
|
|
public bool vortex_motion;
|
|
|
|
private Vector3 Vortex_velocity;
|
|
|
|
private Vector3 Vortex_position;
|
|
|
|
public int Vortex_count = 10;
|
|
|
|
private List<Vortex_PDM> Vortexes;
|
|
|
|
public float Vortex_life = 10f;
|
|
|
|
public float Vortex_angularvelocity = 10f;
|
|
|
|
public float Vortex_scale = 10f;
|
|
|
|
public bool limit_influence;
|
|
|
|
public float Vortex_center_size = 15f;
|
|
|
|
public Color Vortex_center_color = Color.blue;
|
|
|
|
public bool Show_vortex;
|
|
|
|
private int previous_vortex_count;
|
|
|
|
public bool Color_force;
|
|
|
|
public Color Force_color = Color.blue;
|
|
|
|
public bool use_exponent;
|
|
|
|
public bool gravity_pull;
|
|
|
|
public bool Swirl_grav;
|
|
|
|
public bool Bounce_grav;
|
|
|
|
public float Bounce_factor = 1f;
|
|
|
|
public float Affect_tres = 3f;
|
|
|
|
private Vector3 Gravity_Plane_INNER = Vector3.zero;
|
|
|
|
public bool gravity_planar;
|
|
|
|
public Vector3 Gravity_plane = new Vector3(1f, 1f, 1f);
|
|
|
|
public float Gravity_factor = 0.1f;
|
|
|
|
public float Dist_Factor = 1f;
|
|
|
|
public bool enable_paint;
|
|
|
|
private ParticleSystem[] p2;
|
|
|
|
public float affectDistance = 10f;
|
|
|
|
private float sqrDist;
|
|
|
|
private Transform thisTransform;
|
|
|
|
public float dumpen = 2f;
|
|
|
|
private ParticleSystem.Particle[] ParticleList;
|
|
|
|
public bool smoothattraction = true;
|
|
|
|
public bool Lerp_velocity;
|
|
|
|
public bool repel;
|
|
|
|
public bool make_moving_star;
|
|
|
|
public float star_trail_dist = 10f;
|
|
|
|
public bool limit_to_Y_axis;
|
|
|
|
public bool vary_turbulence;
|
|
|
|
public bool perlin_enable;
|
|
|
|
public bool splash_noise;
|
|
|
|
private PerlinSKYMASTER noise;
|
|
|
|
private SimplexNoiseSKYMASTER SIMPLEXnoise;
|
|
|
|
public float noise_str = 20f;
|
|
|
|
public float noise_turb_str = 0.1f;
|
|
|
|
public Vector3 axis_deviation = new Vector3(1f, 1f, 1f);
|
|
|
|
public float splash_noise_tres = 0.05f;
|
|
|
|
public float hit_dist = 10f;
|
|
|
|
private int counter;
|
|
|
|
public int star_trails = 6;
|
|
|
|
public float trail_distance = 1f;
|
|
|
|
public float speed_of_trail = 3f;
|
|
|
|
public float distance_of_trail = 0.5f;
|
|
|
|
public float trail_length_out = 5f;
|
|
|
|
public float size_of_trail_out = 0.05f;
|
|
|
|
public float distance_between_trail = 0.5f;
|
|
|
|
public float vertical_trail_separation = 2.1f;
|
|
|
|
public float smooth_trail = 4.1f;
|
|
|
|
public bool affect_by_tag;
|
|
|
|
public string[] tags;
|
|
|
|
public string[] Exclude_tags;
|
|
|
|
public List<GameObject> Affect_specific;
|
|
|
|
private bool Affect_new;
|
|
|
|
private float recheck_time;
|
|
|
|
public float Time_to_update = 2f;
|
|
|
|
public bool MultiThread;
|
|
|
|
private bool MultiThreaded;
|
|
|
|
private bool init_vortexes;
|
|
|
|
public bool Enable_Preview;
|
|
|
|
public bool End_LifeOf_Affected;
|
|
|
|
public float End_Life = 0.01f;
|
|
|
|
private void Start()
|
|
{
|
|
thisTransform = base.transform;
|
|
if (Affect_specific != null)
|
|
{
|
|
if (Affect_specific.Count > 0)
|
|
{
|
|
p2 = new ParticleSystem[Affect_specific.Count];
|
|
for (int i = 0; i < Affect_specific.Count; i++)
|
|
{
|
|
p2[i] = Affect_specific[i].GetComponent(typeof(ParticleSystem)) as ParticleSystem;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
p2 = UnityEngine.Object.FindObjectsOfType<ParticleSystem>();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Affect_specific = new List<GameObject>();
|
|
p2 = UnityEngine.Object.FindObjectsOfType<ParticleSystem>();
|
|
}
|
|
sqrDist = affectDistance * affectDistance;
|
|
Vortexes = new List<Vortex_PDM>();
|
|
previous_vortex_count = Vortex_count;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (dumpen == 0f)
|
|
{
|
|
dumpen = 1E-09f;
|
|
}
|
|
if (noise == null)
|
|
{
|
|
noise = new PerlinSKYMASTER();
|
|
}
|
|
if (SIMPLEXnoise == null)
|
|
{
|
|
SIMPLEXnoise = new SimplexNoiseSKYMASTER();
|
|
}
|
|
if (!(Application.isPlaying | Enable_Preview))
|
|
{
|
|
return;
|
|
}
|
|
if (!Application.isPlaying)
|
|
{
|
|
MultiThreaded = MultiThread;
|
|
}
|
|
else
|
|
{
|
|
MultiThreaded = MultiThread;
|
|
}
|
|
if (Time.fixedTime - recheck_time > Time_to_update)
|
|
{
|
|
Affect_new = true;
|
|
recheck_time = Time.fixedTime;
|
|
}
|
|
else
|
|
{
|
|
Affect_new = false;
|
|
}
|
|
if (Affect_new & (Affect_specific.Count <= 0))
|
|
{
|
|
p2 = UnityEngine.Object.FindObjectsOfType<ParticleSystem>();
|
|
}
|
|
if (!MultiThreaded)
|
|
{
|
|
Vortexes = new List<Vortex_PDM>();
|
|
}
|
|
trail_distance = MathF.PI * 2f / (float)star_trails;
|
|
sqrDist = affectDistance * affectDistance;
|
|
Vector3 SPHERE_POS = thisTransform.position;
|
|
ParticleSystem[] array = p2;
|
|
foreach (ParticleSystem particleSystem in array)
|
|
{
|
|
if (!(particleSystem != null))
|
|
{
|
|
continue;
|
|
}
|
|
int num = 0;
|
|
if (tags != null)
|
|
{
|
|
for (int j = 0; j < tags.Length; j++)
|
|
{
|
|
if (particleSystem.gameObject.tag == tags[j])
|
|
{
|
|
num = 1;
|
|
}
|
|
}
|
|
}
|
|
bool flag = false;
|
|
if (Exclude_tags != null && Exclude_tags.Length != 0)
|
|
{
|
|
for (int k = 0; k < Exclude_tags.Length; k++)
|
|
{
|
|
if (particleSystem.gameObject.tag == Exclude_tags[k])
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
}
|
|
if (!((!affect_by_tag && !flag) | (affect_by_tag && num == 1)) || !(Vector3.Distance(thisTransform.position, particleSystem.transform.position) < sqrDist * Dist_Factor))
|
|
{
|
|
continue;
|
|
}
|
|
ParticleList = new ParticleSystem.Particle[particleSystem.particleCount];
|
|
particleSystem.GetParticles(ParticleList);
|
|
string p11_tag = particleSystem.gameObject.tag;
|
|
float dist;
|
|
if (MultiThreaded)
|
|
{
|
|
Vector3 p11_transform_pos = particleSystem.transform.position;
|
|
bool World_sim = false;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
World_sim = true;
|
|
}
|
|
float Time_delta = Time.deltaTime;
|
|
float Time_fixed = Time.fixedTime;
|
|
if ((Vortex_count != previous_vortex_count) | !init_vortexes)
|
|
{
|
|
Vortexes = new List<Vortex_PDM>();
|
|
for (int l = 0; l < Vortex_count; l++)
|
|
{
|
|
Vortex_PDM vortex_PDM = new Vortex_PDM();
|
|
vortex_PDM.active = false;
|
|
Vortexes.Add(vortex_PDM);
|
|
}
|
|
init_vortexes = true;
|
|
previous_vortex_count = Vortex_count;
|
|
}
|
|
LoomSKYMASTER.RunAsync(delegate
|
|
{
|
|
if (!make_moving_star)
|
|
{
|
|
int num38 = 0;
|
|
for (int m = 0; m < ParticleList.Length / 2; m++)
|
|
{
|
|
Vector3 vector13 = ParticleList[m].position + p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
vector13 = ParticleList[m].position;
|
|
}
|
|
dist = Vector3.SqrMagnitude(SPHERE_POS - vector13);
|
|
if (dist < sqrDist)
|
|
{
|
|
float num39 = dist;
|
|
if (!smoothattraction)
|
|
{
|
|
num39 = 0f;
|
|
}
|
|
Vector3 vector14 = SPHERE_POS;
|
|
if (repel)
|
|
{
|
|
vector14 = (vector13 - SPHERE_POS) / (dumpen + 0.1f * num39) + p11_transform_pos;
|
|
if (limit_to_Y_axis | (p11_tag == "Grass"))
|
|
{
|
|
vector14 = (vector13 - SPHERE_POS) / (dumpen + 0.1f * num39) + p11_transform_pos;
|
|
vector14 = new Vector3(vector14.x, vector13.y, vector14.z);
|
|
vector14 = (vector13 - SPHERE_POS) / (dumpen + 0.1f * num39) + p11_transform_pos;
|
|
vector14 = new Vector3(vector13.x, vector14.y, vector13.z);
|
|
}
|
|
}
|
|
if (Turbulance)
|
|
{
|
|
Vector3 vector15 = vector13;
|
|
if (Axis_affected.y > 0f)
|
|
{
|
|
vector15.y = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector14.y * Axis_affected.y;
|
|
}
|
|
if (Axis_affected.x > 0f)
|
|
{
|
|
vector15.x = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector14.y * Axis_affected.x;
|
|
}
|
|
if (Axis_affected.z > 0f)
|
|
{
|
|
vector15.z = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector14.y * Axis_affected.z;
|
|
}
|
|
if (vortex_motion & (p11_tag != "VortexSafe") & (p11_tag != "Grass"))
|
|
{
|
|
int num40 = 0;
|
|
for (int n = 0; n < Vortexes.Count; n++)
|
|
{
|
|
if (Vortexes[n].active)
|
|
{
|
|
num40++;
|
|
}
|
|
}
|
|
if (num40 < Vortex_count)
|
|
{
|
|
Vortexes[num40].position = ParticleList[m].position;
|
|
Vortexes[num40].velocity = ParticleList[m].velocity;
|
|
Vortexes[num40].particle_ID = m;
|
|
Vortexes[num40].lifetime = Vortex_life;
|
|
Vortexes[num40].angular_velocity = new Vector3(Vortex_angularvelocity, Vortex_angularvelocity, Vortex_angularvelocity);
|
|
Vortexes[num40].scale = Vortex_scale;
|
|
Vortexes[num40].active = true;
|
|
ParticleList[m].remainingLifetime = Vortex_life;
|
|
}
|
|
for (int num41 = 0; num41 < Vortexes.Count; num41++)
|
|
{
|
|
if ((num41 < Vortexes.Count) & Vortexes[num41].active)
|
|
{
|
|
if (Vortexes[num41].particle_ID == m)
|
|
{
|
|
Vortexes[num41].position = ParticleList[m].position;
|
|
Vortexes[num41].velocity = ParticleList[m].velocity;
|
|
if (Show_vortex)
|
|
{
|
|
ParticleList[m].startSize = Vortex_center_size;
|
|
ParticleList[m].startColor = Vortex_center_color;
|
|
}
|
|
if (Vortexes[num41].lifetime > Vortex_life)
|
|
{
|
|
Vortexes[num41].active = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Vector3 rhs7 = ParticleList[m].position - Vortexes[num41].position;
|
|
if (!(limit_influence & (rhs7.magnitude > Vortexes[num41].scale)))
|
|
{
|
|
Vector3 vector16 = Vector3.Cross(Vortexes[num41].angular_velocity, rhs7);
|
|
float num42 = 1f / (1f + (rhs7.x * rhs7.x + rhs7.y * rhs7.y + rhs7.z * rhs7.z) / Vortexes[num41].scale);
|
|
float x10 = ParticleList[m].velocity.x + (vector16.x - ParticleList[m].velocity.x) * num42;
|
|
float y9 = ParticleList[m].velocity.y + (vector16.y - ParticleList[m].velocity.y) * num42;
|
|
float z10 = ParticleList[m].velocity.z + (vector16.z - ParticleList[m].velocity.z) * num42;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[m].velocity = Vector3.Lerp(ParticleList[m].velocity, new Vector3(x10, y9, z10), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[m].velocity = new Vector3(x10, y9, z10);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
vector14 = new Vector3(vector15.x, vector15.y, vector15.z);
|
|
}
|
|
float num43 = 1f;
|
|
float num44 = 1f;
|
|
if (use_exponent)
|
|
{
|
|
num43 = 1E-09f * dist * (dist * dist * dist * dist);
|
|
num44 = 100000000f;
|
|
float num45 = num44 * Time_delta / (dumpen + 0.1f * num39 * num43);
|
|
num45 = 1f / dist + dumpen;
|
|
num45 = (affectDistance - Mathf.Sqrt(num39)) / (affectDistance + dumpen / 100f) * Time_delta;
|
|
if (!gravity_pull)
|
|
{
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45);
|
|
}
|
|
}
|
|
if (gravity_pull & !gravity_planar)
|
|
{
|
|
Vector3 rhs8 = vector13 - vector14;
|
|
if (Swirl_grav)
|
|
{
|
|
if (Affect_tres < rhs8.magnitude)
|
|
{
|
|
ParticleList[m].velocity = ParticleList[m].velocity - rhs8.normalized * Gravity_factor / dist;
|
|
Gravity_Plane_INNER = ParticleList[m].velocity;
|
|
}
|
|
else if (Bounce_grav)
|
|
{
|
|
ParticleList[m].velocity = ParticleList[m].velocity + Bounce_factor * rhs8.normalized * Gravity_factor / dist;
|
|
}
|
|
else
|
|
{
|
|
Vector3 vector17 = Vector3.Cross(Gravity_Plane_INNER * Vortex_angularvelocity, rhs8);
|
|
float num46 = 1f / (1f + (rhs8.x * rhs8.x + rhs8.y * rhs8.y + rhs8.z * rhs8.z) / Vortex_scale);
|
|
float x11 = ParticleList[m].velocity.x + (vector17.x - ParticleList[m].velocity.x) * num46;
|
|
float y10 = ParticleList[m].velocity.y + (vector17.y - ParticleList[m].velocity.y) * num46;
|
|
float z11 = ParticleList[m].velocity.z + (vector17.z - ParticleList[m].velocity.z) * num46;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[m].velocity = Vector3.Lerp(ParticleList[m].velocity, new Vector3(x11, y10, z11), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[m].velocity = new Vector3(x11, y10, z11);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ParticleList[m].velocity = ParticleList[m].velocity - rhs8.normalized * Gravity_factor / dist;
|
|
}
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45);
|
|
}
|
|
if (rhs8.magnitude <= 0.1f)
|
|
{
|
|
ParticleList[m].remainingLifetime = 0f;
|
|
}
|
|
}
|
|
if (gravity_pull & gravity_planar)
|
|
{
|
|
Vector3 rhs9 = vector13 - vector14;
|
|
Vector3 vector18 = Vector3.Cross(Gravity_plane * Vortex_angularvelocity, rhs9);
|
|
float num47 = 1f / (1f + (rhs9.x * rhs9.x + rhs9.y * rhs9.y + rhs9.z * rhs9.z) / Vortex_scale);
|
|
float x12 = ParticleList[m].velocity.x + (vector18.x - ParticleList[m].velocity.x) * num47;
|
|
float y11 = ParticleList[m].velocity.y + (vector18.y - ParticleList[m].velocity.y) * num47;
|
|
float z12 = ParticleList[m].velocity.z + (vector18.z - ParticleList[m].velocity.z) * num47;
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[m].position = Vector3.Slerp(vector13, vector14, num45);
|
|
}
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[m].velocity = Vector3.Lerp(ParticleList[m].velocity, new Vector3(x12, y11, z12), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[m].velocity = new Vector3(x12, y11, z12);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num43 = 1f;
|
|
num44 = 1f;
|
|
ParticleList[m].position = Vector3.Lerp(vector13, vector14, num44 * Time_delta / (dumpen + 0.1f * num39 * num43)) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[m].position = Vector3.Lerp(vector13, vector14, Time_delta / (dumpen + 0.1f * num39 * num43));
|
|
}
|
|
}
|
|
if (Color_force)
|
|
{
|
|
ParticleList[m].startColor = Color.Lerp(ParticleList[m].startColor, Force_color, 0.1f);
|
|
}
|
|
if (End_LifeOf_Affected)
|
|
{
|
|
ParticleList[m].remainingLifetime = End_Life;
|
|
}
|
|
}
|
|
if (splash_effect && ParticleList[m].remainingLifetime < 0.05f)
|
|
{
|
|
ParticleList[m].remainingLifetime = ParticleList[m].startLifetime;
|
|
ParticleList[m].position = p11_transform_pos;
|
|
}
|
|
if (vary_turbulence)
|
|
{
|
|
float x13 = ParticleList[m].position.x + (2f * noise.Noise(ParticleList[m].position.z * noise_str, ParticleList[m].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
float y12 = ParticleList[m].position.y + (2f * noise.Noise(ParticleList[m].position.z * noise_str, ParticleList[m].position.x * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
float z13 = ParticleList[m].position.z + (2f * noise.Noise(ParticleList[m].position.x * noise_str, ParticleList[m].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
double num48 = 0.0;
|
|
double num49 = 0.0;
|
|
double num50 = 0.0;
|
|
if (perlin_enable)
|
|
{
|
|
num48 = ParticleList[m].velocity.x + noise.Noise(ParticleList[m].position.y * 10f * axis_deviation.y + 1f, ParticleList[m].position.z * 1f * axis_deviation.z) * Time_delta * noise_str * noise_turb_str;
|
|
num49 = ParticleList[m].velocity.y + noise.Noise(ParticleList[m].position.x * 10f * axis_deviation.x + 1f, ParticleList[m].position.z * 1f * axis_deviation.z) * Time_delta * noise_str * noise_turb_str;
|
|
num50 = ParticleList[m].velocity.z + noise.Noise(ParticleList[m].position.x * 10f * axis_deviation.x + 1f, ParticleList[m].position.y * 1f * axis_deviation.y) * Time_delta * noise_str * noise_turb_str;
|
|
}
|
|
else
|
|
{
|
|
num48 = (double)ParticleList[m].velocity.x + SIMPLEXnoise.noise(ParticleList[m].position.y * 10f * axis_deviation.y + 1f, ParticleList[m].position.z * 1f * axis_deviation.z, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
num49 = (double)ParticleList[m].velocity.y + SIMPLEXnoise.noise(ParticleList[m].position.x * 10f * axis_deviation.x + 1f, ParticleList[m].position.z * 1f * axis_deviation.z, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
num50 = (double)ParticleList[m].velocity.z + SIMPLEXnoise.noise(ParticleList[m].position.x * 10f * axis_deviation.x + 1f, ParticleList[m].position.y * 1f * axis_deviation.y, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
}
|
|
ParticleList[m].velocity = new Vector3((float)num48, (float)num49, (float)num50);
|
|
ParticleList[m].position = new Vector3(x13, y12, z13);
|
|
if (splash_noise && ParticleList[m].remainingLifetime < splash_noise_tres)
|
|
{
|
|
if (num38 < Vortexes.Count)
|
|
{
|
|
ParticleList[m].position = Vortexes[num38].position;
|
|
ParticleList[m].remainingLifetime = ParticleList[m].startLifetime;
|
|
num38++;
|
|
}
|
|
else
|
|
{
|
|
num38 = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
if (!make_moving_star)
|
|
{
|
|
int num2 = 0;
|
|
for (int num3 = ParticleList.Length / 2; num3 < ParticleList.Length; num3++)
|
|
{
|
|
Vector3 vector = ParticleList[num3].position + p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
vector = ParticleList[num3].position;
|
|
}
|
|
dist = Vector3.SqrMagnitude(SPHERE_POS - vector);
|
|
if (dist < sqrDist)
|
|
{
|
|
float num4 = dist;
|
|
if (!smoothattraction)
|
|
{
|
|
num4 = 0f;
|
|
}
|
|
Vector3 vector2 = SPHERE_POS;
|
|
if (repel)
|
|
{
|
|
vector2 = (vector - SPHERE_POS) / (dumpen + 0.1f * num4) + p11_transform_pos;
|
|
if (limit_to_Y_axis | (p11_tag == "Grass"))
|
|
{
|
|
vector2 = (vector - SPHERE_POS) / (dumpen + 0.1f * num4) + p11_transform_pos;
|
|
vector2 = new Vector3(vector2.x, vector.y, vector2.z);
|
|
vector2 = (vector - SPHERE_POS) / (dumpen + 0.1f * num4) + p11_transform_pos;
|
|
vector2 = new Vector3(vector.x, vector2.y, vector.z);
|
|
}
|
|
}
|
|
if (Turbulance)
|
|
{
|
|
Vector3 vector3 = vector;
|
|
if (Axis_affected.y > 0f)
|
|
{
|
|
vector3.y = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector2.y * Axis_affected.y;
|
|
}
|
|
if (Axis_affected.x > 0f)
|
|
{
|
|
vector3.x = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector2.y * Axis_affected.x;
|
|
}
|
|
if (Axis_affected.z > 0f)
|
|
{
|
|
vector3.z = Turbulance_strength * Mathf.Cos(Time_fixed * Turbulance_frequency) * vector2.y * Axis_affected.z;
|
|
}
|
|
if (vortex_motion & (p11_tag != "VortexSafe") & (p11_tag != "Grass"))
|
|
{
|
|
int num5 = 0;
|
|
for (int num6 = 0; num6 < Vortexes.Count; num6++)
|
|
{
|
|
if (Vortexes[num6].active)
|
|
{
|
|
num5++;
|
|
}
|
|
}
|
|
if (num5 < Vortex_count)
|
|
{
|
|
Vortexes[num5].position = ParticleList[num3].position;
|
|
Vortexes[num5].velocity = ParticleList[num3].velocity;
|
|
Vortexes[num5].particle_ID = num3;
|
|
Vortexes[num5].lifetime = Vortex_life;
|
|
Vortexes[num5].angular_velocity = new Vector3(Vortex_angularvelocity, Vortex_angularvelocity, Vortex_angularvelocity);
|
|
Vortexes[num5].scale = Vortex_scale;
|
|
Vortexes[num5].active = true;
|
|
ParticleList[num3].remainingLifetime = Vortex_life;
|
|
}
|
|
for (int num7 = 0; num7 < Vortexes.Count; num7++)
|
|
{
|
|
if (!((num7 < Vortexes.Count) & Vortexes[num7].active))
|
|
{
|
|
continue;
|
|
}
|
|
if (Vortexes[num7].particle_ID == num3)
|
|
{
|
|
Vortexes[num7].position = ParticleList[num3].position;
|
|
Vortexes[num7].velocity = ParticleList[num3].velocity;
|
|
if (Show_vortex)
|
|
{
|
|
ParticleList[num3].startSize = Vortex_center_size;
|
|
ParticleList[num3].startColor = Vortex_center_color;
|
|
}
|
|
if (Vortexes[num7].lifetime > Vortex_life)
|
|
{
|
|
Vortexes[num7].active = false;
|
|
}
|
|
continue;
|
|
}
|
|
Vector3 rhs = ParticleList[num3].position - Vortexes[num7].position;
|
|
if (!(limit_influence & (rhs.magnitude > Vortexes[num7].scale)))
|
|
{
|
|
Vector3 vector4 = Vector3.Cross(Vortexes[num7].angular_velocity, rhs);
|
|
float num8 = 1f / (1f + (rhs.x * rhs.x + rhs.y * rhs.y + rhs.z * rhs.z) / Vortexes[num7].scale);
|
|
float x = ParticleList[num3].velocity.x + (vector4.x - ParticleList[num3].velocity.x) * num8;
|
|
float y = ParticleList[num3].velocity.y + (vector4.y - ParticleList[num3].velocity.y) * num8;
|
|
float z = ParticleList[num3].velocity.z + (vector4.z - ParticleList[num3].velocity.z) * num8;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num3].velocity = Vector3.Lerp(ParticleList[num3].velocity, new Vector3(x, y, z), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num3].velocity = new Vector3(x, y, z);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
vector2 = new Vector3(vector3.x, vector3.y, vector3.z);
|
|
}
|
|
float num9 = 1f;
|
|
float num10 = 1f;
|
|
if (use_exponent)
|
|
{
|
|
num9 = 1E-09f * dist * (dist * dist * dist * dist);
|
|
num10 = 100000000f;
|
|
float num11 = num10 * Time_delta / (dumpen + 0.1f * num4 * num9);
|
|
num11 = 1f / dist + dumpen;
|
|
num11 = (affectDistance - Mathf.Sqrt(num4)) / (affectDistance + dumpen / 100f) * Time_delta;
|
|
if (!gravity_pull)
|
|
{
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11);
|
|
}
|
|
}
|
|
if (gravity_pull & !gravity_planar)
|
|
{
|
|
Vector3 rhs2 = vector - vector2;
|
|
if (Swirl_grav)
|
|
{
|
|
if (Affect_tres < rhs2.magnitude)
|
|
{
|
|
ParticleList[num3].velocity = ParticleList[num3].velocity - rhs2.normalized * Gravity_factor / dist;
|
|
Gravity_Plane_INNER = ParticleList[num3].velocity;
|
|
}
|
|
else if (Bounce_grav)
|
|
{
|
|
ParticleList[num3].velocity = ParticleList[num3].velocity + Bounce_factor * rhs2.normalized * Gravity_factor / dist;
|
|
}
|
|
else
|
|
{
|
|
Vector3 vector5 = Vector3.Cross(Gravity_Plane_INNER * Vortex_angularvelocity, rhs2);
|
|
float num12 = 1f / (1f + (rhs2.x * rhs2.x + rhs2.y * rhs2.y + rhs2.z * rhs2.z) / Vortex_scale);
|
|
float x2 = ParticleList[num3].velocity.x + (vector5.x - ParticleList[num3].velocity.x) * num12;
|
|
float y2 = ParticleList[num3].velocity.y + (vector5.y - ParticleList[num3].velocity.y) * num12;
|
|
float z2 = ParticleList[num3].velocity.z + (vector5.z - ParticleList[num3].velocity.z) * num12;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num3].velocity = Vector3.Lerp(ParticleList[num3].velocity, new Vector3(x2, y2, z2), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num3].velocity = new Vector3(x2, y2, z2);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num3].velocity = ParticleList[num3].velocity - rhs2.normalized * Gravity_factor / dist;
|
|
}
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11);
|
|
}
|
|
if (rhs2.magnitude <= 0.1f)
|
|
{
|
|
ParticleList[num3].remainingLifetime = 0f;
|
|
}
|
|
}
|
|
if (gravity_pull & gravity_planar)
|
|
{
|
|
Vector3 rhs3 = vector - vector2;
|
|
Vector3 vector6 = Vector3.Cross(Gravity_plane * Vortex_angularvelocity, rhs3);
|
|
float num13 = 1f / (1f + (rhs3.x * rhs3.x + rhs3.y * rhs3.y + rhs3.z * rhs3.z) / Vortex_scale);
|
|
float x3 = ParticleList[num3].velocity.x + (vector6.x - ParticleList[num3].velocity.x) * num13;
|
|
float y3 = ParticleList[num3].velocity.y + (vector6.y - ParticleList[num3].velocity.y) * num13;
|
|
float z3 = ParticleList[num3].velocity.z + (vector6.z - ParticleList[num3].velocity.z) * num13;
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[num3].position = Vector3.Slerp(vector, vector2, num11);
|
|
}
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num3].velocity = Vector3.Lerp(ParticleList[num3].velocity, new Vector3(x3, y3, z3), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num3].velocity = new Vector3(x3, y3, z3);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num9 = 1f;
|
|
num10 = 1f;
|
|
ParticleList[num3].position = Vector3.Lerp(vector, vector2, num10 * Time_delta / (dumpen + 0.1f * num4 * num9)) - p11_transform_pos;
|
|
if (World_sim)
|
|
{
|
|
ParticleList[num3].position = Vector3.Lerp(vector, vector2, Time_delta / (dumpen + 0.1f * num4 * num9));
|
|
}
|
|
}
|
|
if (Color_force)
|
|
{
|
|
ParticleList[num3].startColor = Color.Lerp(ParticleList[num3].startColor, Force_color, 0.1f);
|
|
}
|
|
if (End_LifeOf_Affected)
|
|
{
|
|
ParticleList[num3].remainingLifetime = End_Life;
|
|
}
|
|
}
|
|
if (splash_effect && ParticleList[num3].remainingLifetime < 0.05f)
|
|
{
|
|
ParticleList[num3].remainingLifetime = ParticleList[num3].startLifetime;
|
|
ParticleList[num3].position = p11_transform_pos;
|
|
}
|
|
if (!vary_turbulence)
|
|
{
|
|
continue;
|
|
}
|
|
float x4 = ParticleList[num3].position.x + (2f * noise.Noise(ParticleList[num3].position.z * noise_str, ParticleList[num3].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
float y4 = ParticleList[num3].position.y + (2f * noise.Noise(ParticleList[num3].position.z * noise_str, ParticleList[num3].position.x * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
float z4 = ParticleList[num3].position.z + (2f * noise.Noise(ParticleList[num3].position.x * noise_str, ParticleList[num3].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time_delta;
|
|
double num14 = 0.0;
|
|
double num15 = 0.0;
|
|
double num16 = 0.0;
|
|
if (perlin_enable)
|
|
{
|
|
num14 = ParticleList[num3].velocity.x + noise.Noise(ParticleList[num3].position.y * 10f * axis_deviation.y + 1f, ParticleList[num3].position.z * 1f * axis_deviation.z) * Time_delta * noise_str * noise_turb_str;
|
|
num15 = ParticleList[num3].velocity.y + noise.Noise(ParticleList[num3].position.x * 10f * axis_deviation.x + 1f, ParticleList[num3].position.z * 1f * axis_deviation.z) * Time_delta * noise_str * noise_turb_str;
|
|
num16 = ParticleList[num3].velocity.z + noise.Noise(ParticleList[num3].position.x * 10f * axis_deviation.x + 1f, ParticleList[num3].position.y * 1f * axis_deviation.y) * Time_delta * noise_str * noise_turb_str;
|
|
}
|
|
else
|
|
{
|
|
num14 = (double)ParticleList[num3].velocity.x + SIMPLEXnoise.noise(ParticleList[num3].position.y * 10f * axis_deviation.y + 1f, ParticleList[num3].position.z * 1f * axis_deviation.z, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
num15 = (double)ParticleList[num3].velocity.y + SIMPLEXnoise.noise(ParticleList[num3].position.x * 10f * axis_deviation.x + 1f, ParticleList[num3].position.z * 1f * axis_deviation.z, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
num16 = (double)ParticleList[num3].velocity.z + SIMPLEXnoise.noise(ParticleList[num3].position.x * 10f * axis_deviation.x + 1f, ParticleList[num3].position.y * 1f * axis_deviation.y, Time_fixed * noise_str) * (double)Time_delta * (double)noise_str * (double)noise_turb_str;
|
|
}
|
|
ParticleList[num3].velocity = new Vector3((float)num14, (float)num15, (float)num16);
|
|
ParticleList[num3].position = new Vector3(x4, y4, z4);
|
|
if (splash_noise && ParticleList[num3].remainingLifetime < splash_noise_tres)
|
|
{
|
|
if (num2 < Vortexes.Count)
|
|
{
|
|
ParticleList[num3].position = Vortexes[num2].position;
|
|
ParticleList[num3].remainingLifetime = ParticleList[num3].startLifetime;
|
|
num2++;
|
|
}
|
|
else
|
|
{
|
|
num2 = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!MultiThreaded && !make_moving_star)
|
|
{
|
|
for (int num17 = 0; num17 < ParticleList.Length; num17++)
|
|
{
|
|
Vector3 vector7 = ParticleList[num17].position + particleSystem.transform.position;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
vector7 = ParticleList[num17].position;
|
|
}
|
|
dist = Vector3.SqrMagnitude(SPHERE_POS - vector7);
|
|
if (dist < sqrDist)
|
|
{
|
|
float num18 = dist;
|
|
if (!smoothattraction)
|
|
{
|
|
num18 = 0f;
|
|
}
|
|
Vector3 vector8 = SPHERE_POS;
|
|
if (repel)
|
|
{
|
|
vector8 = (vector7 - SPHERE_POS) / (dumpen + 0.1f * num18) + particleSystem.transform.position;
|
|
if (limit_to_Y_axis | (p11_tag == "Grass"))
|
|
{
|
|
vector8 = (vector7 - SPHERE_POS) / (dumpen + 0.1f * num18) + particleSystem.transform.position;
|
|
vector8 = new Vector3(vector8.x, vector7.y, vector8.z);
|
|
vector8 = (vector7 - SPHERE_POS) / (dumpen + 0.1f * num18) + particleSystem.transform.position;
|
|
vector8 = new Vector3(vector7.x, vector8.y, vector7.z);
|
|
}
|
|
}
|
|
if (Turbulance)
|
|
{
|
|
Vector3 vector9 = vector7;
|
|
if (Axis_affected.y > 0f)
|
|
{
|
|
vector9.y = Turbulance_strength * Mathf.Cos(Time.fixedTime * Turbulance_frequency) * vector8.y * Axis_affected.y;
|
|
}
|
|
if (Axis_affected.x > 0f)
|
|
{
|
|
vector9.x = Turbulance_strength * Mathf.Cos(Time.fixedTime * Turbulance_frequency) * vector8.y * Axis_affected.x;
|
|
}
|
|
if (Axis_affected.z > 0f)
|
|
{
|
|
vector9.z = Turbulance_strength * Mathf.Cos(Time.fixedTime * Turbulance_frequency) * vector8.y * Axis_affected.z;
|
|
}
|
|
if (vortex_motion & (p11_tag != "VortexSafe") & (p11_tag != "Grass"))
|
|
{
|
|
if (Vortexes.Count < Vortex_count)
|
|
{
|
|
Vortex_PDM vortex_PDM2 = new Vortex_PDM();
|
|
vortex_PDM2.position = ParticleList[num17].position;
|
|
vortex_PDM2.velocity = ParticleList[num17].velocity;
|
|
vortex_PDM2.particle_ID = num17;
|
|
vortex_PDM2.lifetime = Vortex_life;
|
|
vortex_PDM2.angular_velocity = new Vector3(Vortex_angularvelocity, Vortex_angularvelocity, Vortex_angularvelocity);
|
|
vortex_PDM2.scale = Vortex_scale;
|
|
ParticleList[num17].remainingLifetime = Vortex_life;
|
|
Vortexes.Add(vortex_PDM2);
|
|
}
|
|
for (int num19 = 0; num19 < Vortexes.Count; num19++)
|
|
{
|
|
if (num19 >= Vortexes.Count)
|
|
{
|
|
continue;
|
|
}
|
|
if (Vortexes[num19].particle_ID == num17)
|
|
{
|
|
Vortexes[num19].position = ParticleList[num17].position;
|
|
Vortexes[num19].velocity = ParticleList[num17].velocity;
|
|
if (Show_vortex)
|
|
{
|
|
ParticleList[num17].startSize = Vortex_center_size;
|
|
ParticleList[num17].startColor = Vortex_center_color;
|
|
}
|
|
if (Vortexes[num19].lifetime > Vortex_life)
|
|
{
|
|
Vortexes.Remove(Vortexes[num19]);
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
Vector3 rhs4 = ParticleList[num17].position - Vortexes[num19].position;
|
|
if (!(limit_influence & (rhs4.magnitude > Vortexes[num19].scale)))
|
|
{
|
|
Vector3 vector10 = Vector3.Cross(Vortexes[num19].angular_velocity, rhs4);
|
|
float num20 = 1f / (1f + (rhs4.x * rhs4.x + rhs4.y * rhs4.y + rhs4.z * rhs4.z) / Vortexes[num19].scale);
|
|
float x5 = ParticleList[num17].velocity.x + (vector10.x - ParticleList[num17].velocity.x) * num20;
|
|
float y5 = ParticleList[num17].velocity.y + (vector10.y - ParticleList[num17].velocity.y) * num20;
|
|
float z5 = ParticleList[num17].velocity.z + (vector10.z - ParticleList[num17].velocity.z) * num20;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num17].velocity = Vector3.Lerp(ParticleList[num17].velocity, new Vector3(x5, y5, z5), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num17].velocity = new Vector3(x5, y5, z5);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
vector8 = new Vector3(vector9.x, vector9.y, vector9.z);
|
|
}
|
|
float num21 = 1f;
|
|
float num22 = 1f;
|
|
if (use_exponent)
|
|
{
|
|
num21 = 1E-09f * dist * (dist * dist * dist * dist);
|
|
num22 = 100000000f;
|
|
float num23 = num22 * Time.deltaTime / (dumpen + 0.1f * num18 * num21);
|
|
num23 = 1f / dist + dumpen;
|
|
num23 = (affectDistance - Mathf.Sqrt(num18)) / (affectDistance + dumpen / 100f) * Time.deltaTime;
|
|
if (!gravity_pull)
|
|
{
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23) - particleSystem.transform.position;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23);
|
|
}
|
|
}
|
|
if (gravity_pull & !gravity_planar)
|
|
{
|
|
Vector3 rhs5 = vector7 - vector8;
|
|
if (Swirl_grav)
|
|
{
|
|
if (Affect_tres < rhs5.magnitude)
|
|
{
|
|
ParticleList[num17].velocity = ParticleList[num17].velocity - rhs5.normalized * Gravity_factor / dist;
|
|
Gravity_Plane_INNER = ParticleList[num17].velocity;
|
|
}
|
|
else if (Bounce_grav)
|
|
{
|
|
ParticleList[num17].velocity = ParticleList[num17].velocity + Bounce_factor * rhs5.normalized * Gravity_factor / dist;
|
|
}
|
|
else
|
|
{
|
|
Vector3 vector11 = Vector3.Cross(Gravity_Plane_INNER * Vortex_angularvelocity, rhs5);
|
|
float num24 = 1f / (1f + (rhs5.x * rhs5.x + rhs5.y * rhs5.y + rhs5.z * rhs5.z) / Vortex_scale);
|
|
float x6 = ParticleList[num17].velocity.x + (vector11.x - ParticleList[num17].velocity.x) * num24;
|
|
float y6 = ParticleList[num17].velocity.y + (vector11.y - ParticleList[num17].velocity.y) * num24;
|
|
float z6 = ParticleList[num17].velocity.z + (vector11.z - ParticleList[num17].velocity.z) * num24;
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num17].velocity = Vector3.Lerp(ParticleList[num17].velocity, new Vector3(x6, y6, z6), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num17].velocity = new Vector3(x6, y6, z6);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num17].velocity = ParticleList[num17].velocity - rhs5.normalized * Gravity_factor / dist;
|
|
}
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23) - particleSystem.transform.position;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23);
|
|
}
|
|
if (rhs5.magnitude <= 0.1f)
|
|
{
|
|
ParticleList[num17].remainingLifetime = 0f;
|
|
}
|
|
}
|
|
if (gravity_pull & gravity_planar)
|
|
{
|
|
Vector3 rhs6 = vector7 - vector8;
|
|
Vector3 vector12 = Vector3.Cross(Gravity_plane * Vortex_angularvelocity, rhs6);
|
|
float num25 = 1f / (1f + (rhs6.x * rhs6.x + rhs6.y * rhs6.y + rhs6.z * rhs6.z) / Vortex_scale);
|
|
float x7 = ParticleList[num17].velocity.x + (vector12.x - ParticleList[num17].velocity.x) * num25;
|
|
float y7 = ParticleList[num17].velocity.y + (vector12.y - ParticleList[num17].velocity.y) * num25;
|
|
float z7 = ParticleList[num17].velocity.z + (vector12.z - ParticleList[num17].velocity.z) * num25;
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23) - particleSystem.transform.position;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
ParticleList[num17].position = Vector3.Slerp(vector7, vector8, num23);
|
|
}
|
|
if (Lerp_velocity)
|
|
{
|
|
ParticleList[num17].velocity = Vector3.Lerp(ParticleList[num17].velocity, new Vector3(x7, y7, z7), 0.5f);
|
|
}
|
|
else
|
|
{
|
|
ParticleList[num17].velocity = new Vector3(x7, y7, z7);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
num21 = 1f;
|
|
num22 = 1f;
|
|
ParticleList[num17].position = Vector3.Lerp(vector7, vector8, num22 * Time.deltaTime / (dumpen + 0.1f * num18 * num21)) - particleSystem.transform.position;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
ParticleList[num17].position = Vector3.Lerp(vector7, vector8, Time.deltaTime / (dumpen + 0.1f * num18 * num21));
|
|
}
|
|
}
|
|
if (Color_force)
|
|
{
|
|
ParticleList[num17].startColor = Color.Lerp(ParticleList[num17].startColor, Force_color, 0.1f);
|
|
}
|
|
if (End_LifeOf_Affected)
|
|
{
|
|
ParticleList[num17].remainingLifetime = End_Life;
|
|
}
|
|
}
|
|
if (splash_effect && ParticleList[num17].remainingLifetime < 0.05f)
|
|
{
|
|
ParticleList[num17].remainingLifetime = ParticleList[num17].startLifetime;
|
|
ParticleList[num17].position = particleSystem.transform.position;
|
|
}
|
|
if (!vary_turbulence)
|
|
{
|
|
continue;
|
|
}
|
|
float x8 = ParticleList[num17].position.x + (2f * noise.Noise(ParticleList[num17].position.z * noise_str, ParticleList[num17].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time.deltaTime;
|
|
float y8 = ParticleList[num17].position.y + (2f * noise.Noise(ParticleList[num17].position.z * noise_str, ParticleList[num17].position.x * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time.deltaTime;
|
|
float z8 = ParticleList[num17].position.z + (2f * noise.Noise(ParticleList[num17].position.x * noise_str, ParticleList[num17].position.y * noise_str * 0.77f + 1f) - 0f) * noise_turb_str * Time.deltaTime;
|
|
double num26 = 0.0;
|
|
double num27 = 0.0;
|
|
double num28 = 0.0;
|
|
if (perlin_enable)
|
|
{
|
|
num26 = ParticleList[num17].velocity.x + noise.Noise(ParticleList[num17].position.y * 10f * axis_deviation.y + 1f, ParticleList[num17].position.z * 1f * axis_deviation.z) * Time.deltaTime * noise_str * noise_turb_str;
|
|
num27 = ParticleList[num17].velocity.y + noise.Noise(ParticleList[num17].position.x * 10f * axis_deviation.x + 1f, ParticleList[num17].position.z * 1f * axis_deviation.z) * Time.deltaTime * noise_str * noise_turb_str;
|
|
num28 = ParticleList[num17].velocity.z + noise.Noise(ParticleList[num17].position.x * 10f * axis_deviation.x + 1f, ParticleList[num17].position.y * 1f * axis_deviation.y) * Time.deltaTime * noise_str * noise_turb_str;
|
|
}
|
|
else
|
|
{
|
|
num26 = (double)ParticleList[num17].velocity.x + SIMPLEXnoise.noise(ParticleList[num17].position.y * 10f * axis_deviation.y + 1f, ParticleList[num17].position.z * 1f * axis_deviation.z, Time.fixedTime * noise_str) * (double)Time.deltaTime * (double)noise_str * (double)noise_turb_str;
|
|
num27 = (double)ParticleList[num17].velocity.y + SIMPLEXnoise.noise(ParticleList[num17].position.x * 10f * axis_deviation.x + 1f, ParticleList[num17].position.z * 1f * axis_deviation.z, Time.fixedTime * noise_str) * (double)Time.deltaTime * (double)noise_str * (double)noise_turb_str;
|
|
num28 = (double)ParticleList[num17].velocity.z + SIMPLEXnoise.noise(ParticleList[num17].position.x * 10f * axis_deviation.x + 1f, ParticleList[num17].position.y * 1f * axis_deviation.y, Time.fixedTime * noise_str) * (double)Time.deltaTime * (double)noise_str * (double)noise_turb_str;
|
|
}
|
|
ParticleList[num17].velocity = new Vector3((float)num26, (float)num27, (float)num28);
|
|
ParticleList[num17].position = new Vector3(x8, y8, z8);
|
|
if (splash_noise && ParticleList[num17].remainingLifetime < splash_noise_tres)
|
|
{
|
|
ParticleList[num17].remainingLifetime = ParticleList[num17].startLifetime;
|
|
int num29 = UnityEngine.Random.Range(0, Vortexes.Count - 1);
|
|
if (num29 < Vortexes.Count)
|
|
{
|
|
ParticleList[num17].position = Vortexes[num29].position;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetMouseButton(0) & (particleSystem.particleCount > 2) & enable_paint)
|
|
{
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
RaycastHit hitInfo = default(RaycastHit);
|
|
if (Physics.Raycast(ray, out hitInfo, 100f))
|
|
{
|
|
if ((ParticleList != null) & (ParticleList.Length > 3) & (counter > 0) & (counter < ParticleList.Length))
|
|
{
|
|
ParticleList[counter].position = particleSystem.gameObject.transform.position + particleSystem.gameObject.transform.InverseTransformPoint(hitInfo.normal * hit_dist + hitInfo.point);
|
|
}
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
if ((ParticleList != null) & (ParticleList.Length > 3) & (counter > 0) & (counter < ParticleList.Length))
|
|
{
|
|
ParticleList[counter].position = hitInfo.point;
|
|
}
|
|
}
|
|
else if ((ParticleList != null) & (ParticleList.Length > 3) & (counter > 0) & (counter < ParticleList.Length))
|
|
{
|
|
ParticleList[counter].position = particleSystem.transform.position - hitInfo.point;
|
|
}
|
|
counter++;
|
|
if (counter >= particleSystem.particleCount - 1)
|
|
{
|
|
counter = 0;
|
|
}
|
|
}
|
|
}
|
|
float num30 = Vector3.Distance(particleSystem.transform.position, base.transform.position);
|
|
if (make_moving_star & (particleSystem.particleCount > 2) & repel & (num30 < star_trail_dist))
|
|
{
|
|
for (int num31 = 0; num31 < star_trails; num31++)
|
|
{
|
|
float num32 = 0f;
|
|
float f = (float)num31 * trail_distance;
|
|
float num33 = 0f;
|
|
for (int num34 = 0; num34 < particleSystem.particleCount / star_trails; num34++)
|
|
{
|
|
int num35 = num31 * (particleSystem.particleCount / star_trails) + num34;
|
|
float num36 = 1f;
|
|
if (num30 > 0f)
|
|
{
|
|
num36 = trail_length_out / num30;
|
|
}
|
|
float num37 = size_of_trail_out * num30;
|
|
num33 = num36 + distance_of_trail * num32;
|
|
Vector3 position = particleSystem.transform.localPosition;
|
|
position.x = num33 * Mathf.Cos(num32) + position.x;
|
|
position.z = num33 * Mathf.Sin(num32) + position.z;
|
|
float x9 = position.x * Mathf.Cos(f) + position.z * Mathf.Sin(f);
|
|
float z9 = (0f - position.x) * Mathf.Sin(f) + position.z * Mathf.Cos(f);
|
|
position.x = x9;
|
|
position.z = z9;
|
|
position.y = (float)num34 * vertical_trail_separation + position.y;
|
|
if (particleSystem.main.simulationSpace == ParticleSystemSimulationSpace.World)
|
|
{
|
|
position = particleSystem.transform.TransformPoint(position);
|
|
}
|
|
ParticleList[num35].position = position;
|
|
num32 += distance_between_trail;
|
|
ParticleList[num35].startSize = ParticleList[num35].startSize - (float)num34 * num37;
|
|
ParticleList[num35].angularVelocity = ParticleList[num35].angularVelocity - (float)num34 * smooth_trail;
|
|
}
|
|
}
|
|
}
|
|
if (make_moving_star)
|
|
{
|
|
particleSystem.transform.Rotate(base.transform.up * Time.deltaTime * (0f - speed_of_trail), Space.World);
|
|
}
|
|
particleSystem.SetParticles(ParticleList, particleSystem.particleCount);
|
|
}
|
|
}
|
|
}
|
|
}
|