Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SmokeTrailParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
SmokeTrailParticleSystem
:
ParticleSystem
<SmokeTrailParticleSystem.Particle>,
ITrailParticleSystem
{
6
public
class
Particle
:
Game
.
Particle
{
7
public
float
Time
;
8
9
public
float
Duration
;
10
11
public
Vector3
Velocity
;
12
}
13
14
public
Random
m_random
=
new
();
15
16
public
float
m_toGenerate
;
17
18
public
float
m_textureSlotMultiplier
;
19
20
public
float
m_textureSlotOffset
;
21
22
public
float
m_duration
;
23
24
public
float
m_size
;
25
26
public
float
m_maxDuration
;
27
28
public
Color
m_color
;
29
30
public
Vector3
Position
{
get
;
set
; }
31
32
public
bool
IsStopped
{
get
;
set
; }
33
34
public
SmokeTrailParticleSystem
(
int
particlesCount,
float
size,
float
maxDuration,
Color
color) : base(particlesCount) {
35
m_size
= size;
36
m_maxDuration
= maxDuration;
37
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/FireParticle"
);
38
TextureSlotsCount
= 3;
39
m_textureSlotMultiplier
=
m_random
.Float(1.1f, 1.9f);
40
m_textureSlotOffset
=
m_random
.Float(0f, 1f) < 0.33f ? 3 : 0;
41
m_color
= color;
42
}
43
44
public
override
bool
Simulate
(
float
dt) {
45
m_duration
+= dt;
46
if
(
m_duration
>
m_maxDuration
) {
47
IsStopped
=
true
;
48
}
49
float
num = Math.Clamp(50f /
m_size
, 10f, 40f);
50
m_toGenerate
+= num * dt;
51
float
num2 = MathF.Pow(0.1f, dt);
52
bool
flag =
false
;
53
for
(
int
i = 0; i <
Particles
.Length; i++) {
54
Particle
particle =
Particles
[i];
55
if
(particle.
IsActive
) {
56
flag =
true
;
57
particle.Time += dt;
58
if
(particle.
Time
<= particle.
Duration
) {
59
particle.Position += particle.Velocity * dt;
60
particle.Velocity *= num2;
61
particle.Velocity.Y += 10f * dt;
62
particle.TextureSlot = (int)
MathUtils
.
Min
(
63
9f * particle.
Time
/ particle.
Duration
*
m_textureSlotMultiplier
+
m_textureSlotOffset
,
64
8f
65
);
66
particle.Size =
new
Vector2
(
m_size
* (0.15f + 0.8f * particle.
Time
/ particle.
Duration
));
67
}
68
else
{
69
particle.IsActive =
false
;
70
}
71
}
72
else
if
(!
IsStopped
73
&&
m_toGenerate
>= 1f) {
74
particle.IsActive =
true
;
75
Vector3
v =
new
(
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f));
76
particle.Position =
Position
+ 0.025f * v;
77
particle.Color =
m_color
;
78
particle.Velocity = 0.2f * v;
79
particle.Time = 0f;
80
particle.Size =
new
Vector2
(0.15f *
m_size
);
81
particle.Duration = Particles.Length / num *
m_random
.Float(0.8f, 1.05f);
82
particle.FlipX =
m_random
.Bool();
83
particle.FlipY =
m_random
.Bool();
84
m_toGenerate
-= 1f;
85
}
86
}
87
if
(
IsStopped
) {
88
return
!flag;
89
}
90
return
false
;
91
}
92
}
93
}
Engine.Graphics.Texture2D
定义
Texture2D.cs:15
Engine.MathUtils
定义
MathUtils.cs:2
Engine.MathUtils.Min
static int Min(int x1, int x2)
定义
MathUtils.cs:7
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.Particle.IsActive
bool IsActive
定义
Particle.cs:5
Game.ParticleSystem-1-g.TextureSlotsCount
int TextureSlotsCount
定义
ParticleSystem.cs:33
Game.ParticleSystem-1-g.Texture
Texture2D Texture
定义
ParticleSystem.cs:22
Game.ParticleSystem-1-g.ParticleSystem
ParticleSystem(int particlesCount)
定义
ParticleSystem.cs:35
Game.ParticleSystem-1-g.Particles
T[] Particles
定义
ParticleSystem.cs:20
Game.Random
定义
Random.cs:5
Game.SmokeTrailParticleSystem.Particle
定义
SmokeTrailParticleSystem.cs:6
Game.SmokeTrailParticleSystem.Particle.Time
float Time
定义
SmokeTrailParticleSystem.cs:7
Game.SmokeTrailParticleSystem.Particle.Velocity
Vector3 Velocity
定义
SmokeTrailParticleSystem.cs:11
Game.SmokeTrailParticleSystem.Particle.Duration
float Duration
定义
SmokeTrailParticleSystem.cs:9
Game.SmokeTrailParticleSystem.m_textureSlotOffset
float m_textureSlotOffset
定义
SmokeTrailParticleSystem.cs:20
Game.SmokeTrailParticleSystem.m_duration
float m_duration
定义
SmokeTrailParticleSystem.cs:22
Game.SmokeTrailParticleSystem.IsStopped
bool IsStopped
定义
SmokeTrailParticleSystem.cs:32
Game.SmokeTrailParticleSystem.m_size
float m_size
定义
SmokeTrailParticleSystem.cs:24
Game.SmokeTrailParticleSystem.m_toGenerate
float m_toGenerate
定义
SmokeTrailParticleSystem.cs:16
Game.SmokeTrailParticleSystem.Simulate
override bool Simulate(float dt)
定义
SmokeTrailParticleSystem.cs:44
Game.SmokeTrailParticleSystem.m_textureSlotMultiplier
float m_textureSlotMultiplier
定义
SmokeTrailParticleSystem.cs:18
Game.SmokeTrailParticleSystem.m_color
Color m_color
定义
SmokeTrailParticleSystem.cs:28
Game.SmokeTrailParticleSystem.m_random
Random m_random
定义
SmokeTrailParticleSystem.cs:14
Game.SmokeTrailParticleSystem.SmokeTrailParticleSystem
SmokeTrailParticleSystem(int particlesCount, float size, float maxDuration, Color color)
定义
SmokeTrailParticleSystem.cs:34
Game.SmokeTrailParticleSystem.m_maxDuration
float m_maxDuration
定义
SmokeTrailParticleSystem.cs:26
Game.SmokeTrailParticleSystem.Position
Vector3 Position
定义
SmokeTrailParticleSystem.cs:30
Game.ITrailParticleSystem
定义
ITrailParticleSystem.cs:4
Engine.Graphics
定义
BaseBatch.cs:1
Engine.Graphics.ShaderParameterType.Vector2
@ Vector2
定义
ShaderParameterType.cs:4
Engine
定义
BaseSound.cs:10
Game
定义
ContentFileBridge.cs:4
Engine.Color
定义
Color.cs:2
Engine.Vector3
定义
Vector3.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
SmokeTrailParticleSystem.cs
制作者
1.16.1