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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
MyCard
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
Pipeline
#17414
passed with stages
in 20 minutes and 11 seconds
Changes
1
Pipelines
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 @@
...
@@ -4,6 +4,7 @@
*/
*/
using
UnityEngine
;
using
UnityEngine
;
using
System.Collections
;
using
System.Collections
;
using
static
UnityEngine
.
ParticleSystem
;
public
class
LightningBolt
:
MonoBehaviour
public
class
LightningBolt
:
MonoBehaviour
{
{
...
@@ -17,15 +18,18 @@ public class LightningBolt : MonoBehaviour
...
@@ -17,15 +18,18 @@ public class LightningBolt : MonoBehaviour
Perlin
noise
;
Perlin
noise
;
float
oneOverZigs
;
float
oneOverZigs
;
// private Particle[] particles;
private
ParticleSystem
ps
;
private
Particle
[]
particles
;
void
Start
()
void
Start
()
{
{
oneOverZigs
=
1f
/
(
float
)
zigs
;
oneOverZigs
=
1f
/
(
float
)
zigs
;
// GetComponent<ParticleEmitter>().emit = false;
ps
=
GetComponent
<
ParticleSystem
>();
particles
=
new
Particle
[
zigs
];
// GetComponent<ParticleEmitter>().Emit(zigs);
var
em
=
ps
.
emission
;
// particles = GetComponent<ParticleEmitter>().particles;
em
.
enabled
=
false
;
ps
.
Emit
(
zigs
);
ps
.
GetParticles
(
particles
);
}
}
void
Update
()
void
Update
()
...
@@ -37,27 +41,27 @@ public class LightningBolt : MonoBehaviour
...
@@ -37,27 +41,27 @@ public class LightningBolt : MonoBehaviour
float
timey
=
Time
.
time
*
speed
*
1.21688f
;
float
timey
=
Time
.
time
*
speed
*
1.21688f
;
float
timez
=
Time
.
time
*
speed
*
2.5564f
;
float
timez
=
Time
.
time
*
speed
*
2.5564f
;
// for (int i=0; i < particles.Length; i++)
for
(
int
i
=
0
;
i
<
particles
.
Length
;
i
++)
// {
{
// Vector3 position = Vector3.Lerp(transform.position, target.position, oneOverZigs * (float)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),
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
(
timey
+
position
.
x
,
timey
+
position
.
y
,
timey
+
position
.
z
),
// noise.Noise(timez + position.x, timez + position.y, timez + position.z));
noise
.
Noise
(
timez
+
position
.
x
,
timez
+
position
.
y
,
timez
+
position
.
z
));
// position += (offset * scale * ((float)i * oneOverZigs));
position
+=
(
offset
*
scale
*
((
float
)
i
*
oneOverZigs
));
//
// particles[i].position = position;
particles
[
i
].
position
=
position
;
// particles[i].color = Color.white;
particles
[
i
].
startColor
=
Color
.
white
;
// particles[i].energy = 1f;
//particles[i].energy = 1f;
// }
}
//
// GetComponent<ParticleEmitter>().particles = particles;
ps
.
SetParticles
(
particles
);
//
// if (GetComponent<ParticleEmitter>().particleCount >= 2)
if
(
ps
.
particleCount
>=
2
)
// {
{
// if (startLight)
if
(
startLight
)
// startLight.transform.position = particles[0].position;
startLight
.
transform
.
position
=
particles
[
0
].
position
;
// if (endLight)
if
(
endLight
)
// endLight.transform.position = particles[particles.Length - 1].position;
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