Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
OnFireParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
OnFireParticleSystem
:
ParticleSystem
<OnFireParticleSystem.Particle> {
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
bool
m_visible
;
19
20
public
bool
IsStopped
{
get
;
set
; }
21
22
public
Vector3
Position
{
get
;
set
; }
23
24
public
float
Radius
{
get
;
set
; }
25
26
public
OnFireParticleSystem
() : base(25) {
27
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/FireParticle"
);
28
TextureSlotsCount
= 3;
29
}
30
31
public
override
bool
Simulate
(
float
dt) {
32
bool
flag =
false
;
33
if
(
m_visible
) {
34
m_toGenerate
+= 20f * dt;
35
float
num = MathF.Pow(0.02f, dt);
36
for
(
int
i = 0; i <
Particles
.Length; i++) {
37
Particle
particle =
Particles
[i];
38
if
(particle.
IsActive
) {
39
flag =
true
;
40
particle.Time += dt;
41
if
(particle.
Time
<= particle.
Duration
) {
42
particle.Position += particle.Velocity * dt;
43
particle.Velocity *= num;
44
particle.Velocity.Y += 10f * dt;
45
particle.TextureSlot = (int)
MathUtils
.
Min
(9f * particle.
Time
/ particle.
Duration
* 1.2f, 8f);
46
}
47
else
{
48
particle.IsActive =
false
;
49
}
50
}
51
else
if
(!
IsStopped
) {
52
if
(
m_toGenerate
>= 1f) {
53
particle.IsActive =
true
;
54
Vector3
v =
new
(
m_random
.Float(-1f, 1f),
m_random
.Float(0f, 1f),
m_random
.Float(-1f, 1f));
55
particle.Position =
Position
+ 0.75f *
Radius
* v;
56
particle.Color =
Color
.
White
;
57
particle.Velocity = 1.5f * v;
58
particle.Size =
new
Vector2
(0.5f);
59
particle.Time = 0f;
60
particle.Duration =
m_random
.Float(0.5f, 1.5f);
61
particle.FlipX =
m_random
.Bool();
62
particle.FlipY =
m_random
.Bool();
63
m_toGenerate
-= 1f;
64
}
65
}
66
else
{
67
m_toGenerate
= 0f;
68
}
69
}
70
m_toGenerate
=
MathUtils
.
Remainder
(
m_toGenerate
, 1f);
71
m_visible
=
false
;
72
}
73
if
(
IsStopped
&& !flag) {
74
return
true
;
75
}
76
return
false
;
77
}
78
79
public
override
void
Draw
(
Camera
camera) {
80
float
num =
Vector3
.
Dot
(
Position
- camera.
ViewPosition
, camera.
ViewDirection
);
81
if
(num > -5f
82
&& num <= 48f) {
83
m_visible
=
true
;
84
base.Draw(camera);
85
}
86
}
87
}
88
}
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
Game.Camera
定义
Camera.cs:5
Game.Camera.ViewPosition
Vector3 ViewPosition
定义
Camera.cs:10
Game.Camera.ViewDirection
Vector3 ViewDirection
定义
Camera.cs:12
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.OnFireParticleSystem.Particle
定义
OnFireParticleSystem.cs:6
Game.OnFireParticleSystem.Particle.Duration
float Duration
定义
OnFireParticleSystem.cs:9
Game.OnFireParticleSystem.Particle.Velocity
Vector3 Velocity
定义
OnFireParticleSystem.cs:11
Game.OnFireParticleSystem.Particle.Time
float Time
定义
OnFireParticleSystem.cs:7
Game.OnFireParticleSystem.OnFireParticleSystem
OnFireParticleSystem()
定义
OnFireParticleSystem.cs:26
Game.OnFireParticleSystem.Simulate
override bool Simulate(float dt)
定义
OnFireParticleSystem.cs:31
Game.OnFireParticleSystem.m_visible
bool m_visible
定义
OnFireParticleSystem.cs:18
Game.OnFireParticleSystem.Position
Vector3 Position
定义
OnFireParticleSystem.cs:22
Game.OnFireParticleSystem.Draw
override void Draw(Camera camera)
定义
OnFireParticleSystem.cs:79
Game.OnFireParticleSystem.IsStopped
bool IsStopped
定义
OnFireParticleSystem.cs:20
Game.OnFireParticleSystem.Radius
float Radius
定义
OnFireParticleSystem.cs:24
Game.OnFireParticleSystem.m_random
Random m_random
定义
OnFireParticleSystem.cs:14
Game.OnFireParticleSystem.m_toGenerate
float m_toGenerate
定义
OnFireParticleSystem.cs:16
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
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.Dot
static float Dot(Vector3 v1, Vector3 v2)
定义
Vector3.cs:112
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
OnFireParticleSystem.cs
制作者
1.16.1