Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SoundParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
SoundParticleSystem
:
ParticleSystem
<SoundParticleSystem.Particle> {
6
public
class
Particle
:
Game
.
Particle
{
7
public
float
TimeToLive
;
8
9
public
Vector3
Velocity
;
10
11
public
Color
BaseColor
;
12
}
13
14
public
Random
m_random
=
new
();
15
16
public
Vector3
m_position
;
17
18
public
Vector3
m_direction
;
19
20
// ReSharper disable UnusedParameter.Local
21
public
SoundParticleSystem
(
SubsystemTerrain
terrain,
Vector3
position,
Vector3
direction)
22
// ReSharper restore UnusedParameter.Local
23
: base(15) {
24
m_position
= position;
25
m_direction
= direction;
26
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/SoundParticle"
);
27
TextureSlotsCount
= 2;
28
}
29
30
public
void
AddNote
(
Color
color) {
31
int
num = 0;
32
Particle
particle;
33
while
(
true
) {
34
if
(num <
Particles
.Length) {
35
particle =
Particles
[num];
36
if
(!
Particles
[num].IsActive) {
37
break
;
38
}
39
num++;
40
continue
;
41
}
42
return
;
43
}
44
particle.IsActive =
true
;
45
particle.Position =
m_position
;
46
particle.Color =
Color
.
White
;
47
particle.Size =
new
Vector2
(0.1f);
48
particle.TimeToLive =
m_random
.Float(1f, 1.5f);
49
particle.Velocity = 3f * (
m_direction
+
m_random
.Vector3(0.5f));
50
particle.BaseColor = color;
51
particle.TextureSlot =
m_random
.Int(0,
TextureSlotsCount
*
TextureSlotsCount
- 1);
52
particle.BillboardingMode =
ParticleBillboardingMode
.Vertical;
53
}
54
55
public
override
bool
Simulate
(
float
dt) {
56
dt = Math.Clamp(dt, 0f, 0.1f);
57
float
num = MathF.Pow(0.02f, dt);
58
bool
flag =
false
;
59
for
(
int
i = 0; i <
Particles
.Length; i++) {
60
Particle
particle =
Particles
[i];
61
if
(particle.
IsActive
) {
62
flag =
true
;
63
particle.TimeToLive -= dt;
64
if
(particle.
TimeToLive
> 0f) {
65
particle.Velocity +=
new
Vector3
(0f, 5f, 0f) * dt;
66
particle.Velocity *= num;
67
particle.Position += particle.Velocity * dt;
68
particle.Color = particle.BaseColor *
MathUtils
.
Saturate
(2f * particle.
TimeToLive
);
69
}
70
else
{
71
particle.IsActive =
false
;
72
}
73
}
74
}
75
return
!flag;
76
}
77
}
78
}
Vector3
Engine.Vector3 Vector3
定义
SubsystemAudio.cs:5
Engine.Graphics.Texture2D
定义
Texture2D.cs:15
Engine.MathUtils
定义
MathUtils.cs:2
Engine.MathUtils.Saturate
static float Saturate(float x)
定义
MathUtils.cs:163
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.Particle.Color
Color Color
定义
Particle.cs:17
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.SoundParticleSystem.Particle
定义
SoundParticleSystem.cs:6
Game.SoundParticleSystem.Particle.Velocity
Vector3 Velocity
定义
SoundParticleSystem.cs:9
Game.SoundParticleSystem.Particle.TimeToLive
float TimeToLive
定义
SoundParticleSystem.cs:7
Game.SoundParticleSystem.Particle.BaseColor
Color BaseColor
定义
SoundParticleSystem.cs:11
Game.SoundParticleSystem.SoundParticleSystem
SoundParticleSystem(SubsystemTerrain terrain, Vector3 position, Vector3 direction)
定义
SoundParticleSystem.cs:21
Game.SoundParticleSystem.Simulate
override bool Simulate(float dt)
定义
SoundParticleSystem.cs:55
Game.SoundParticleSystem.m_position
Vector3 m_position
定义
SoundParticleSystem.cs:16
Game.SoundParticleSystem.m_direction
Vector3 m_direction
定义
SoundParticleSystem.cs:18
Game.SoundParticleSystem.AddNote
void AddNote(Color color)
定义
SoundParticleSystem.cs:30
Game.SoundParticleSystem.m_random
Random m_random
定义
SoundParticleSystem.cs:14
Game.SubsystemTerrain
定义
SubsystemTerrain.cs:6
Engine.Graphics
定义
BaseBatch.cs:1
Engine.Graphics.ShaderParameterType.Vector2
@ Vector2
定义
ShaderParameterType.cs:4
Engine
定义
BaseSound.cs:10
Game
定义
ContentFileBridge.cs:4
Game.ParticleBillboardingMode
ParticleBillboardingMode
定义
ParticleBillboardingMode.cs:2
Engine.Color
定义
Color.cs:2
Engine.Color.White
static Color White
定义
Color.cs:15
Engine.Vector3
定义
Vector3.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
SoundParticleSystem.cs
制作者
1.16.1