Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOProUnity_V2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOProUnity_V2
Commits
3f55e113
Commit
3f55e113
authored
Oct 24, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix LightningBolt unity ParticleSystem
parent
6f0d3cbd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
32 deletions
+36
-32
Assets/old/UiverseAssests/art_plugin/thunder/RAYOS/Sources/LightningBolt.cs
...Assests/art_plugin/thunder/RAYOS/Sources/LightningBolt.cs
+36
-32
No files found.
Assets/old/UiverseAssests/art_plugin/thunder/RAYOS/Sources/LightningBolt.cs
View file @
3f55e113
...
...
@@ -4,6 +4,7 @@
*/
using
UnityEngine
;
using
System.Collections
;
using
static
UnityEngine
.
ParticleSystem
;
public
class
LightningBolt
:
MonoBehaviour
{
...
...
@@ -17,15 +18,18 @@ public class LightningBolt : MonoBehaviour
Perlin
noise
;
float
oneOverZigs
;
// private Particle[] particles;
private
ParticleSystem
ps
;
private
Particle
[]
particles
;
void
Start
()
{
oneOverZigs
=
1f
/
(
float
)
zigs
;
// GetComponent<ParticleEmitter>().emit = false;
// GetComponent<ParticleEmitter>().Emit(zigs);
// particles = GetComponent<ParticleEmitter>().particles;
ps
=
GetComponent
<
ParticleSystem
>();
particles
=
new
Particle
[
zigs
];
var
em
=
ps
.
emission
;
em
.
enabled
=
false
;
ps
.
Emit
(
zigs
);
ps
.
GetParticles
(
particles
);
}
void
Update
()
...
...
@@ -37,27 +41,27 @@ public class LightningBolt : MonoBehaviour
float
timey
=
Time
.
time
*
speed
*
1.21688f
;
float
timez
=
Time
.
time
*
speed
*
2.5564f
;
// for (int i=0; i < particles.Length; i++)
// {
// Vector3 position = Vector3.Lerp(transform.position, target.position, oneOverZigs * (float)i);
// Vector3 offset = new Vector3(noise.Noise(timex + position.x, timex + position.y, timex + position.z),
// noise.Noise(timey + position.x, timey + position.y, timey + position.z),
// noise.Noise(timez + position.x, timez + position.y, timez + position.z));
// position += (offset * scale * ((float)i * oneOverZigs));
//
// particles[i].position = position;
// particles[i].color = Color.white;
// particles[i].energy = 1f;
// }
//
// GetComponent<ParticleEmitter>().particles = particles;
//
// if (GetComponent<ParticleEmitter>().particleCount >= 2)
// {
// if (startLight)
// startLight.transform.position = particles[0].position;
// if (endLight)
// endLight.transform.position = particles[particles.Length - 1].position;
//
}
for
(
int
i
=
0
;
i
<
particles
.
Length
;
i
++)
{
Vector3
position
=
Vector3
.
Lerp
(
transform
.
position
,
target
.
position
,
oneOverZigs
*
(
float
)
i
);
Vector3
offset
=
new
Vector3
(
noise
.
Noise
(
timex
+
position
.
x
,
timex
+
position
.
y
,
timex
+
position
.
z
),
noise
.
Noise
(
timey
+
position
.
x
,
timey
+
position
.
y
,
timey
+
position
.
z
),
noise
.
Noise
(
timez
+
position
.
x
,
timez
+
position
.
y
,
timez
+
position
.
z
));
position
+=
(
offset
*
scale
*
((
float
)
i
*
oneOverZigs
));
particles
[
i
].
position
=
position
;
particles
[
i
].
startColor
=
Color
.
white
;
//particles[i].energy = 1f;
}
ps
.
SetParticles
(
particles
);
if
(
ps
.
particleCount
>=
2
)
{
if
(
startLight
)
startLight
.
transform
.
position
=
particles
[
0
].
position
;
if
(
endLight
)
endLight
.
transform
.
position
=
particles
[
particles
.
Length
-
1
].
position
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment