Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
WhalePlumeParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
WhalePlumeParticleSystem
:
ParticleSystem
<WhalePlumeParticleSystem.Particle> {
6
public
class
Particle
:
Game
.
Particle
{
7
public
Vector3
Velocity
;
8
9
public
float
Time
;
10
11
public
float
Duration
;
12
}
13
14
public
Random
m_random
=
new
();
15
16
public
float
m_time
;
17
18
public
float
m_duration
;
19
20
public
float
m_size
;
21
22
public
float
m_toGenerate
;
23
24
public
bool
IsStopped
{
get
;
set
; }
25
26
public
Vector3
Position
{
get
;
set
; }
27
28
// ReSharper disable UnusedParameter.Local
29
public
WhalePlumeParticleSystem
(
SubsystemTerrain
terrain,
float
size,
float
duration)
30
// ReSharper restore UnusedParameter.Local
31
: base(100) {
32
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/WaterSplashParticle"
);
33
TextureSlotsCount
= 2;
34
m_size
= size;
35
m_duration
= duration;
36
}
37
38
public
override
bool
Simulate
(
float
dt) {
39
m_time
+= dt;
40
if
(
m_time
<
m_duration
41
&& !
IsStopped
) {
42
m_toGenerate
+= 60f * dt;
43
}
44
else
{
45
m_toGenerate
= 0f;
46
}
47
float
num = MathF.Pow(0.001f, dt);
48
float
num2 =
MathUtils
.
Lerp
(4f, 10f,
MathUtils
.
Saturate
(2f *
m_time
/
m_duration
));
49
Vector3
v =
new
(0f, 1f, 2f);
50
bool
flag =
false
;
51
for
(
int
i = 0; i <
Particles
.Length; i++) {
52
Particle
particle =
Particles
[i];
53
if
(particle.
IsActive
) {
54
flag =
true
;
55
particle.Time += dt;
56
if
(particle.
Time
<= particle.
Duration
) {
57
particle.Position += particle.Velocity * dt;
58
particle.Velocity *= num;
59
particle.Velocity += v * dt;
60
particle.TextureSlot = (int)
MathUtils
.
Min
(4f * particle.
Time
/ particle.
Duration
* 1.2f, 3f);
61
particle.Size =
new
Vector2
(
m_size
) *
MathUtils
.
Lerp
(0.1f, 0.2f, particle.
Time
/ particle.
Duration
);
62
}
63
else
{
64
particle.IsActive =
false
;
65
}
66
}
67
else
if
(
m_toGenerate
>= 1f) {
68
particle.IsActive =
true
;
69
Vector3
v2 = 0.1f *
m_size
*
new
Vector3
(
m_random
.Float(-1f, 1f),
m_random
.Float(0f, 2f),
m_random
.Float(-1f, 1f));
70
particle.Position =
Position
+ v2;
71
particle.Color =
new
Color
(200, 220, 210);
72
particle.Velocity = 1f *
m_size
*
new
Vector3
(
m_random
.Float(-1f, 1f), num2 *
m_random
.Float(0.3f, 1f),
m_random
.Float(-1f, 1f));
73
particle.Size =
Vector2
.
Zero
;
74
particle.Time = 0f;
75
particle.Duration =
m_random
.Float(1f, 3f);
76
particle.FlipX =
m_random
.Bool();
77
particle.FlipY =
m_random
.Bool();
78
m_toGenerate
-= 1f;
79
}
80
}
81
m_toGenerate
=
MathUtils
.
Remainder
(
m_toGenerate
, 1f);
82
if
(!flag
83
&& (
m_time
>=
m_duration
||
IsStopped
)) {
84
return
true
;
85
}
86
return
false
;
87
}
88
}
89
}
Color
Engine.Color Color
定义
CommunityContentScreen.cs:9
Vector3
Engine.Vector3 Vector3
定义
SubsystemAudio.cs:5
Engine.Graphics.Texture2D
定义
Texture2D.cs:15
Engine.MathUtils
定义
MathUtils.cs:2
Engine.MathUtils.Remainder
static float Remainder(float x, float y)
定义
MathUtils.cs:183
Engine.MathUtils.Min
static int Min(int x1, int x2)
定义
MathUtils.cs:7
Engine.MathUtils.Saturate
static float Saturate(float x)
定义
MathUtils.cs:163
Engine.MathUtils.Lerp
static float Lerp(float x1, float x2, float f)
定义
MathUtils.cs:213
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.SubsystemTerrain
定义
SubsystemTerrain.cs:6
Game.WhalePlumeParticleSystem.Particle
定义
WhalePlumeParticleSystem.cs:6
Game.WhalePlumeParticleSystem.Particle.Duration
float Duration
定义
WhalePlumeParticleSystem.cs:11
Game.WhalePlumeParticleSystem.Particle.Time
float Time
定义
WhalePlumeParticleSystem.cs:9
Game.WhalePlumeParticleSystem.Particle.Velocity
Vector3 Velocity
定义
WhalePlumeParticleSystem.cs:7
Game.WhalePlumeParticleSystem.Simulate
override bool Simulate(float dt)
定义
WhalePlumeParticleSystem.cs:38
Game.WhalePlumeParticleSystem.m_toGenerate
float m_toGenerate
定义
WhalePlumeParticleSystem.cs:22
Game.WhalePlumeParticleSystem.m_size
float m_size
定义
WhalePlumeParticleSystem.cs:20
Game.WhalePlumeParticleSystem.WhalePlumeParticleSystem
WhalePlumeParticleSystem(SubsystemTerrain terrain, float size, float duration)
定义
WhalePlumeParticleSystem.cs:29
Game.WhalePlumeParticleSystem.m_time
float m_time
定义
WhalePlumeParticleSystem.cs:16
Game.WhalePlumeParticleSystem.m_random
Random m_random
定义
WhalePlumeParticleSystem.cs:14
Game.WhalePlumeParticleSystem.Position
Vector3 Position
定义
WhalePlumeParticleSystem.cs:26
Game.WhalePlumeParticleSystem.IsStopped
bool IsStopped
定义
WhalePlumeParticleSystem.cs:24
Game.WhalePlumeParticleSystem.m_duration
float m_duration
定义
WhalePlumeParticleSystem.cs:18
Engine.Graphics
定义
BaseBatch.cs:1
Engine.Graphics.ShaderParameterType.Vector2
@ Vector2
定义
ShaderParameterType.cs:4
Engine
定义
BaseSound.cs:10
Game
定义
ContentFileBridge.cs:4
Engine.Vector2
定义
Vector2.cs:2
Engine.Vector2.Zero
static readonly Vector2 Zero
定义
Vector2.cs:7
Engine.Vector3
定义
Vector3.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
WhalePlumeParticleSystem.cs
制作者
1.16.1