Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
KillParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
KillParticleSystem
:
ParticleSystem
<KillParticleSystem.Particle> {
6
public
class
Particle
:
Game
.
Particle
{
7
public
Vector3
Velocity
;
8
9
public
float
TimeToLive
;
10
}
11
12
public
Random
m_random
=
new
();
13
14
public
KillParticleSystem
(
SubsystemTerrain
terrain,
Vector3
position,
float
size) : base(20) {
15
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/KillParticle"
);
16
int
num =
Terrain
.
ToCell
(position.
X
);
17
int
num2 =
Terrain
.
ToCell
(position.
Y
);
18
int
num3 =
Terrain
.
ToCell
(position.
Z
);
19
int
x = 0;
20
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num + 1, num2, num3));
21
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num - 1, num2, num3));
22
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2 + 1, num3));
23
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2 - 1, num3));
24
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2, num3 + 1));
25
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2, num3 - 1));
26
TextureSlotsCount
= 2;
27
Color
white =
Color
.
White
;
28
float
num4 =
LightingManager
.
LightIntensityByLightValue
[x];
29
white *= num4;
30
white.A = 255;
31
for (
int
i = 0; i <
Particles
.Length; i++) {
32
Particle
obj =
Particles
[i];
33
obj.IsActive =
true
;
34
obj.Position = position + 0.4f * size *
new
Vector3
(
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f));
35
obj.Color = white;
36
obj.Size =
new
Vector2
(0.3f * size);
37
obj.TimeToLive =
m_random
.Float(0.5f, 3.5f);
38
obj.Velocity = 1.2f * size *
new
Vector3
(
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f),
m_random
.Float(-1f, 1f));
39
obj.FlipX =
m_random
.Bool();
40
obj.FlipY =
m_random
.Bool();
41
}
42
}
43
44
public
override
bool
Simulate
(
float
dt) {
45
dt = Math.Clamp(dt, 0f, 0.1f);
46
float
num = MathF.Pow(0.1f, dt);
47
bool
flag =
false
;
48
for
(
int
i = 0; i <
Particles
.Length; i++) {
49
Particle
particle =
Particles
[i];
50
if
(particle.
IsActive
) {
51
flag =
true
;
52
particle.TimeToLive -= dt;
53
if
(particle.
TimeToLive
> 0f) {
54
particle.Position += particle.Velocity * dt;
55
particle.Velocity.Y += 1f * dt;
56
particle.Velocity *= num;
57
particle.TextureSlot = (int)(3.99f *
MathUtils
.
Saturate
(2f - particle.
TimeToLive
));
58
}
59
else
{
60
particle.IsActive =
false
;
61
}
62
}
63
}
64
return
!flag;
65
}
66
}
67
}
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
Engine.MathUtils.Max
static int Max(int x1, int x2)
定义
MathUtils.cs:18
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.KillParticleSystem.Particle
定义
KillParticleSystem.cs:6
Game.KillParticleSystem.Particle.TimeToLive
float TimeToLive
定义
KillParticleSystem.cs:9
Game.KillParticleSystem.Particle.Velocity
Vector3 Velocity
定义
KillParticleSystem.cs:7
Game.KillParticleSystem.Simulate
override bool Simulate(float dt)
定义
KillParticleSystem.cs:44
Game.KillParticleSystem.m_random
Random m_random
定义
KillParticleSystem.cs:12
Game.KillParticleSystem.KillParticleSystem
KillParticleSystem(SubsystemTerrain terrain, Vector3 position, float size)
定义
KillParticleSystem.cs:14
Game.LightingManager
定义
LightingManager.cs:4
Game.LightingManager.LightIntensityByLightValue
static readonly float[] LightIntensityByLightValue
定义
LightingManager.cs:11
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.SubsystemTerrain.Terrain
virtual Terrain Terrain
定义
SubsystemTerrain.cs:50
Game.Terrain
定义
Terrain.cs:5
Game.Terrain.GetCellLight
virtual int GetCellLight(int x, int y, int z)
定义
Terrain.cs:232
Game.Terrain.ToCell
static int ToCell(float x)
定义
Terrain.cs:210
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.Color.White
static Color White
定义
Color.cs:15
Engine.Vector3
定义
Vector3.cs:2
Engine.Vector3.Y
float Y
定义
Vector3.cs:5
Engine.Vector3.Z
float Z
定义
Vector3.cs:7
Engine.Vector3.X
float X
定义
Vector3.cs:3
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
KillParticleSystem.cs
制作者
1.16.1