Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MagmaSplashParticleSystem.cs
浏览该文件的文档.
1
using
Engine
;
2
using
Engine.Graphics
;
3
4
namespace
Game
{
5
public
class
MagmaSplashParticleSystem
:
ParticleSystem
<MagmaSplashParticleSystem.Particle> {
6
public
class
Particle
:
Game
.
Particle
{
7
public
Vector3
Velocity
;
8
9
public
float
TimeToLive
;
10
11
public
float
Duration
;
12
}
13
14
public
Random
m_random
=
new
();
15
16
public
SubsystemTerrain
m_subsystemTerrain
;
17
18
public
Vector3
m_position
;
19
20
public
float
m_time
;
21
22
public
MagmaSplashParticleSystem
(
SubsystemTerrain
terrain,
Vector3
position,
bool
large) : base(40) {
23
m_subsystemTerrain
= terrain;
24
m_position
= position;
25
Texture
=
ContentManager
.
Get
<
Texture2D
>(
"Textures/MagmaSplashParticle"
);
26
TextureSlotsCount
= 2;
27
int
num =
Terrain
.
ToCell
(position.
X
);
28
int
num2 =
Terrain
.
ToCell
(position.
Y
);
29
int
num3 =
Terrain
.
ToCell
(position.
Z
);
30
int
x = 0;
31
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num + 1, num2, num3));
32
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num - 1, num2, num3));
33
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2 + 1, num3));
34
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2 - 1, num3));
35
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2, num3 + 1));
36
x =
MathUtils
.
Max
(x, terrain.
Terrain
.
GetCellLight
(num, num2, num3 - 1));
37
Color
white =
Color
.
White
;
38
float
num4 =
LightingManager
.
LightIntensityByLightValue
[x];
39
white *= num4;
40
white.A = 255;
41
float
num5 = large ? 1.5f : 1f;
42
for (
int
i = 0; i <
Particles
.Length; i++) {
43
Particle
obj =
Particles
[i];
44
obj.IsActive =
true
;
45
obj.Position = position;
46
obj.Color = white;
47
obj.Size =
new
Vector2
(0.2f * num5);
48
obj.TimeToLive = obj.Duration =
m_random
.Float(0.5f, 3.5f);
49
Vector3
v = 4f *
m_random
.Float(0.1f, 1f) *
Vector3
.
Normalize
(
new
Vector3
(
m_random
.Float(-1f, 1f), 0f,
m_random
.Float(-1f, 1f)));
50
obj.Velocity = num5 * (v +
new
Vector3
(0f,
m_random
.Float(0f, 4f), 0f));
51
}
52
}
53
54
public
override
bool
Simulate
(
float
dt) {
55
dt = Math.Clamp(dt, 0f, 0.1f);
56
float
num = MathF.Pow(0.015f, dt);
57
m_time
+= dt;
58
bool
flag =
false
;
59
for
(
int
i = 0; i <
Particles
.Length; i++) {
60
Particle
particle =
Particles
[i];
61
if
(!particle.
IsActive
) {
62
continue
;
63
}
64
flag =
true
;
65
particle.Position += particle.Velocity * dt;
66
particle.Velocity.Y += -10f * dt;
67
particle.Velocity *= num;
68
particle.Color *=
MathUtils
.
Saturate
(particle.
TimeToLive
);
69
particle.TimeToLive -= dt;
70
particle.TextureSlot = (int)(3.99f * particle.
TimeToLive
/ particle.
Duration
);
71
particle.FlipX =
m_random
.Sign() > 0;
72
particle.FlipY =
m_random
.Sign() > 0;
73
if
(particle.
TimeToLive
<= 0f
74
|| particle.
Size
.
X
<= 0f) {
75
particle.IsActive =
false
;
76
continue
;
77
}
78
int
cellValue =
m_subsystemTerrain
.Terrain.GetCellValue(
79
Terrain
.
ToCell
(particle.
Position
.
X
),
80
Terrain
.
ToCell
(particle.
Position
.
Y
),
81
Terrain
.
ToCell
(particle.
Position
.
Z
)
82
);
83
int
num2 =
Terrain
.
ExtractContents
(cellValue);
84
if
(num2 == 0) {
85
continue
;
86
}
87
Block
block =
BlocksManager
.
Blocks
[num2];
88
if
(block.
IsCollidable_
(cellValue)) {
89
particle.IsActive =
true
;
90
}
91
else
if
(block is
MagmaBlock
) {
92
int
level =
FluidBlock
.
GetLevel
(
Terrain
.
ExtractData
(cellValue));
93
float
levelHeight = ((
MagmaBlock
)block).GetLevelHeight(level);
94
if
(particle.
Position
.
Y
<= MathF.Floor(particle.
Position
.
Y
) + levelHeight) {
95
particle.Velocity.Y = 0f;
96
float
num3 =
Vector2
.
Distance
(
new
Vector2
(particle.
Position
.
X
, particle.
Position
.
Z
),
new
Vector2
(
m_position
.X,
m_position
.Z));
97
float
num4 = 0.02f * MathF.Sin(2f * num3 + 10f *
m_time
);
98
particle.Position.Y = MathF.Floor(particle.
Position
.
Y
) + levelHeight + num4;
99
particle.TimeToLive -= 1f * dt;
100
particle.Size -=
new
Vector2
(0.04f * dt);
101
}
102
}
103
}
104
return
!flag;
105
}
106
}
107
}
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.Block
定义
Block.cs:5
Game.Block.IsCollidable_
virtual bool IsCollidable_(int value)
定义
Block.cs:260
Game.BlocksManager
定义
BlocksManager.cs:10
Game.BlocksManager.Blocks
static Block[] Blocks
定义
BlocksManager.cs:41
Game.ContentManager
定义
ContentManager.cs:50
Game.ContentManager.Get
static object Get(Type type, string name)
定义
ContentManager.cs:70
Game.FluidBlock
定义
FluidBlock.cs:5
Game.FluidBlock.GetLevel
static int GetLevel(int data)
定义
FluidBlock.cs:196
Game.LightingManager
定义
LightingManager.cs:4
Game.LightingManager.LightIntensityByLightValue
static readonly float[] LightIntensityByLightValue
定义
LightingManager.cs:11
Game.MagmaBlock
定义
MagmaBlock.cs:3
Game.MagmaSplashParticleSystem.Particle
定义
MagmaSplashParticleSystem.cs:6
Game.MagmaSplashParticleSystem.Particle.TimeToLive
float TimeToLive
定义
MagmaSplashParticleSystem.cs:9
Game.MagmaSplashParticleSystem.Particle.Velocity
Vector3 Velocity
定义
MagmaSplashParticleSystem.cs:7
Game.MagmaSplashParticleSystem.Particle.Duration
float Duration
定义
MagmaSplashParticleSystem.cs:11
Game.MagmaSplashParticleSystem.m_time
float m_time
定义
MagmaSplashParticleSystem.cs:20
Game.MagmaSplashParticleSystem.m_subsystemTerrain
SubsystemTerrain m_subsystemTerrain
定义
MagmaSplashParticleSystem.cs:16
Game.MagmaSplashParticleSystem.Simulate
override bool Simulate(float dt)
定义
MagmaSplashParticleSystem.cs:54
Game.MagmaSplashParticleSystem.MagmaSplashParticleSystem
MagmaSplashParticleSystem(SubsystemTerrain terrain, Vector3 position, bool large)
定义
MagmaSplashParticleSystem.cs:22
Game.MagmaSplashParticleSystem.m_random
Random m_random
定义
MagmaSplashParticleSystem.cs:14
Game.MagmaSplashParticleSystem.m_position
Vector3 m_position
定义
MagmaSplashParticleSystem.cs:18
Game.Particle.IsActive
bool IsActive
定义
Particle.cs:5
Game.Particle.Position
Vector3 Position
定义
Particle.cs:7
Game.Particle.Size
Vector2 Size
定义
Particle.cs:13
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.ExtractContents
static int ExtractContents(int value)
定义
Terrain.cs:303
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
Game.Terrain.ExtractData
static int ExtractData(int value)
定义
Terrain.cs:307
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.Vector2
定义
Vector2.cs:2
Engine.Vector2.X
float X
定义
Vector2.cs:3
Engine.Vector2.Distance
static float Distance(Vector2 v1, Vector2 v2)
定义
Vector2.cs:53
Engine.Vector3
定义
Vector3.cs:2
Engine.Vector3.Y
float Y
定义
Vector3.cs:5
Engine.Vector3.Normalize
static Vector3 Normalize(Vector3 v)
定义
Vector3.cs:154
Engine.Vector3.Z
float Z
定义
Vector3.cs:7
Engine.Vector3.X
float X
定义
Vector3.cs:3
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
Game
MagmaSplashParticleSystem.cs
制作者
1.16.1