2 using Microsoft.Xna.Framework;
4 using System.Collections.Generic;
32 [
Editable(0.0f,
float.MaxValue),
Serialize(0.0f,
IsPropertySaveable.No, description:
"Will randomize lifetime value between lifetime and lifetimeMin. If left to 0 will use only lifetime value.")]
42 private float angularVelocityMin;
48 get {
return angularVelocityMin; }
51 angularVelocityMin = value;
56 private float angularVelocityMax;
62 get {
return angularVelocityMax; }
65 angularVelocityMax = value;
70 private float startRotationMin;
76 get {
return startRotationMin; }
79 startRotationMin = value;
84 private float startRotationMax;
90 get {
return startRotationMax; }
93 startRotationMax = value;
102 public float Drag {
get;
private set; }
107 private Vector2 velocityChange;
113 get {
return velocityChange; }
116 velocityChange = value;
121 private Vector2 velocityChangeWater;
127 get {
return velocityChangeWater; }
130 velocityChangeWater = value;
135 [
Editable,
Serialize(
true,
IsPropertySaveable.No, description:
"Is the particle considered to be inside a submarine if it spawns at a position inside a hull (causing it to move with the sub)?")]
150 [
Editable(0.0f, 1.0f),
Serialize(0.5f,
IsPropertySaveable.No, description:
"The friction coefficient of the particle, i.e. how much it slows down when it's sliding against a surface.")]
154 [
Serialize(0.5f,
IsPropertySaveable.No, description:
"How much of the particle's velocity is conserved when it collides with something, i.e. the \"bounciness\" of the particle. (0.0 = the particle stops completely).")]
165 [
Editable,
Serialize(
"0.0,0.0",
IsPropertySaveable.No, description:
"How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
168 [
Editable,
Serialize(
"0.0,0.0",
IsPropertySaveable.No, description:
"How much the size of the particle changes per second. The rate of growth for each particle is randomize between SizeChangeMin and SizeChangeMax.")]
171 [
Editable(minValue: 0, maxValue:
float.MaxValue, decimals: 2),
Serialize(0.0f,
IsPropertySaveable.No, description:
"How many seconds it takes for the particle to grow to it's initial size.")]
194 [
Editable,
Serialize(
false,
IsPropertySaveable.No, description:
"Draw the particle even when it's calculated to be outside of view (the formula doesn't take scales into account). ")]
200 [
Editable,
Serialize(0,
IsPropertySaveable.No, description:
"Particles with a higher priority can replace lower-priority ones if the maximum number of active particles has been reached.")]
213 public readonly List<ParticleEmitterPrefab>
SubEmitters =
new List<ParticleEmitterPrefab>();
236 DebugConsole.AddWarning($
"Error in particle prefab {Identifier}: additive particles cannot be rendered in the background.");
239 foreach (var subElement
in element.Elements())
241 switch (subElement.Name.ToString().ToLowerInvariant())
247 case "animatedsprite":
250 case "particleemitter":
260 DebugConsole.ThrowError($
"Particle prefab \"{Name}\" in the file \"{file}\" has no sprites defined!",
261 contentPackage: element.ContentPackage);
265 if (element.GetAttribute(
"velocitychangewater") ==
null)
270 if (element.GetAttribute(
"angularvelocity") !=
null)
276 if (element.GetAttribute(
"startsize") !=
null)
278 StartSizeMin = element.GetAttributeVector2(
"startsize", Vector2.One);
282 if (element.GetAttribute(
"sizechange") !=
null)
284 SizeChangeMin = element.GetAttributeVector2(
"sizechange", Vector2.Zero);
288 if (element.GetAttribute(
"startrotation") !=
null)
Base class for content file types, which are loaded from filelist.xml via reflection....
bool GetAttributeBool(string key, bool def)
static ParticleManager ParticleManager
ParticleBlendState BlendState
Dictionary< Identifier, SerializableProperty > SerializableProperties
ParticleDrawOrder DrawOrder
Vector2 VelocityChangeWater
static readonly PrefabCollection< ParticlePrefab > Prefabs
ParticlePrefab(ContentXElement element, ContentFile file)
float AngularVelocityMaxRad
DrawTargetType DrawTarget
Vector2 VelocityChangeWaterDisplay
Vector2 CalculateEndSize()
readonly List< ParticleEmitterPrefab > SubEmitters
float StartRotationMaxRad
float StartRotationMinRad
bool InvariantCollisionSize
readonly List< Sprite > Sprites
Vector2 CalculateEndPosition(Vector2 startPosition, Vector2 velocity)
Vector2 VelocityChangeDisplay
float AngularVelocityMinRad
readonly Identifier Identifier
static Dictionary< Identifier, SerializableProperty > DeserializeProperties(object obj, XElement element=null)