本文整理汇总了C#中ParticleEffect类的典型用法代码示例。如果您正苦于以下问题:C# ParticleEffect类的具体用法?C# ParticleEffect怎么用?C# ParticleEffect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParticleEffect类属于命名空间,在下文中一共展示了ParticleEffect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnValueChanged
public static void OnValueChanged(object sender, OnValueChangeEventArgs args)
{
var oldOne = args.GetOldValue<KeyBind>().Active;
var newOne = args.GetNewValue<KeyBind>().Active;
if (oldOne == newOne) return;
if (newOne)
{
_effect?.Dispose();
_effect = Members.MyHero.AddParticleEffect("materials/ensage_ui/particles/line.vpcf");
var frontPoint = Members.MyHero.InFront(1200);
_effect.SetControlPoint(1, Members.MyHero.Position);
_effect.SetControlPoint(2, frontPoint);
_effect.SetControlPoint(3, new Vector3(255, 50, 0));
_effect.SetControlPoint(4, new Vector3(255, 255, 255));
}
else
try
{
_tks.Cancel();
_effect?.Dispose();
}
catch (Exception)
{
// ignored
}
}
示例2: Serialize
/// <summary>
/// Serializes the specified ParticleEffect instance.
/// </summary>
/// <param name="effect">The ParticleEffect to be serialized.</param>
/// <param name="filename">The desired output file name,</param>
public void Serialize(ParticleEffect effect, string filename)
{
// Create a new xml document...
XDocument xmlDocument = new XDocument();
// Use the XNA serializer to populate the xml document...
using (XmlWriter writer = xmlDocument.CreateWriter())
{
IntermediateSerializer.Serialize<ParticleEffect>(writer, effect, ".\\");
}
//// hack: Workaround for intermediate serializer not putting nodes in the right order...
//foreach (XElement emitterElement in xmlDocument.Descendants("Asset").Elements("Item"))
//{
// XElement releaseQuantityElement = emitterElement.Element("ReleaseQuantity");
// if ((releaseQuantityElement.PreviousNode as XElement).Name == "Name")
// {
// XElement termElement = emitterElement.Element("Term");
// termElement.AddAfterSelf(releaseQuantityElement);
// releaseQuantityElement.Remove();
// }
//}
// Save the xml document...
xmlDocument.Save(filename);
}
示例3: Init
void Init()
{
Effect = new ParticleEffect();
Effect.OnEnding += new ParticleEffect.ParticleEffectEventHandler(Effect_OnEnding);
Effect.Texture = Create.Texture("blurredbar");
Effect.Position = Position;
Effect.ParticleCount = 150;
Effect.GenerationPeriod = .1D;
Effect.GenerationCount = 20;
Effect.Gravity = 0F;
Effect.Mass = new Vector2f(10, 10);
Effect.MinPosition = new Vector2f(-15F, -4F);
Effect.MaxPosition = new Vector2f(15F, 4F);
Effect.MinColor = Color.Green;
Effect.MaxColor = Color.Green;
Effect.Acceleration = new Vector2f(0f, 5f);
Effect.AlphaLimit = new Vector2f(0.55f, .8f);
Effect.Angle = new Vector2f(270f, 270f);
Effect.DurationTime = new Vector2f(.5f, 1.2f);
Effect.Rotation = new Vector2f(0, 0);
Effect.MinScale = new Vector2f(.003f, .003f);
Effect.MaxScale = new Vector2f(.02f, .02f);
const float SV = .1F;
Effect.MinScaleVariation = new Vector2f(SV, SV);
Effect.MaxScaleVariation = new Vector2f(SV, SV);
Effect.Velocity = new Vector2f(10F, 70F);
Effect.Init();
}
示例4: ParticleMapEffect
public ParticleMapEffect(ParticleMapEffect copy)
: base(copy)
{
DrawOrder = DrawOrder.Normal;
Effect = new ParticleEffect(copy.Effect);
}
示例5: Gfx
private Gfx()
{
var images = new ImageCollection();
// walls
images.AddImage("walls", "Resources/gfx/blocks/green-wall.png");
images.AddImage("trees", "Resources/gfx/blocks/tree-wall.png");
// players
images.AddImage("player-movement", "Resources/gfx/tanks/tank.png");
images.AddImage("enemy-movement", "Resources/gfx/tanks/enemy.png");
images.AddImage("player-bullet-flight", "Resources/gfx/bullets/bullet.png");
// menu
images.AddImage("game-menu-background", "Resources/gfx/menu/title.png");
images.AddImage("game-ground", "Resources/gfx/menu/title.png");
// bonus
images.AddImage("bonus-boom", "Resources/gfx/bonus/boom.png");
images.AddImage("bonus-health", "Resources/gfx/bonus/health.png");
images.AddImage("bonus-life", "Resources/gfx/bonus/life.png");
m_worldTexture = new Texture(images, PixelFormat.DefaultAlpha);
UnitExplosion = new ParticleEffect("Resources/gfx/particles/rocket-explosion-smoke.peff");
RocketExplosionParticleEffect = new ParticleEffect("Resources/gfx/particles/rocket-explosion.peff");
}
示例6: CreateRangeDisplay
/// <summary>
/// The create range display.
/// </summary>
public void CreateRangeDisplay()
{
this.RangeDisplay = this.Entity.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
this.RangeDisplay.SetControlPoint(1, new Vector3(255, 80, 80));
this.RangeDisplay.SetControlPoint(3, new Vector3(9, 0, 0));
this.RangeDisplay.SetControlPoint(2, new Vector3(this.Radius + 30, 255, 0));
}
示例7: ParticleSystem
public ParticleSystem(ParticleSettings settings, Effect effect)
{
if (settings == null) throw new ArgumentNullException("settings");
if (effect == null) throw new ArgumentNullException("effect");
if (settings.Texture == null) throw new ArgumentException("Texture is null.");
Enabled = true;
this.settings = settings;
//----------------------------------------------------------------
// システム名
Name = settings.Name;
//----------------------------------------------------------------
// エフェクト
particleEffect = new ParticleEffect(effect);
particleEffect.Initialize(settings, settings.Texture);
graphicsDevice = particleEffect.GraphicsDevice;
//----------------------------------------------------------------
// パーティクル
particles = new ParticleVertex[settings.MaxParticles * 4];
for (int i = 0; i < settings.MaxParticles; i++)
{
particles[i * 4 + 0].Corner = new Short2(-1, -1);
particles[i * 4 + 1].Corner = new Short2(1, -1);
particles[i * 4 + 2].Corner = new Short2(1, 1);
particles[i * 4 + 3].Corner = new Short2(-1, 1);
}
//----------------------------------------------------------------
// 頂点バッファ
vertexBuffer = new DynamicVertexBuffer(
graphicsDevice, ParticleVertex.VertexDeclaration, settings.MaxParticles * 4, BufferUsage.WriteOnly);
//----------------------------------------------------------------
// インデックス バッファ
var indices = new ushort[settings.MaxParticles * 6];
for (int i = 0; i < settings.MaxParticles; i++)
{
indices[i * 6 + 0] = (ushort) (i * 4 + 0);
indices[i * 6 + 1] = (ushort) (i * 4 + 1);
indices[i * 6 + 2] = (ushort) (i * 4 + 2);
indices[i * 6 + 3] = (ushort) (i * 4 + 0);
indices[i * 6 + 4] = (ushort) (i * 4 + 2);
indices[i * 6 + 5] = (ushort) (i * 4 + 3);
}
indexBuffer = new IndexBuffer(graphicsDevice, typeof(ushort), indices.Length, BufferUsage.WriteOnly);
indexBuffer.SetData(indices);
}
示例8: Tombstone
public Tombstone(Unit unit)
{
this.unit = unit;
PositionCorrection = new Vector2(25);
var level = (uint)char.GetNumericValue(unit.Name.Last());
Radius =
Ability.GetAbilityDataByName(AbilityName)
.AbilitySpecialData.First(x => x.Name == "radius")
.GetValue(level - 1);
Duration =
Ability.GetAbilityDataByName(AbilityName)
.AbilitySpecialData.First(x => x.Name == "duration")
.GetValue(level - 1);
Position = unit.Position;
Texture = Drawing.GetTexture("materials/ensage_ui/other/tombstone");
Handle = unit.Handle;
TextureSize = new Vector2(40);
EndTime = Game.RawGameTime + Duration;
ShowTimer = Menu.TimerEnabled(AbilityName);
if (Menu.RangeEnabled(AbilityName))
{
ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
ParticleEffect.SetControlPoint(1, new Vector3(128, 128, 128));
ParticleEffect.SetControlPoint(2, new Vector3(Radius, 255, 0));
}
}
示例9: Create
/// <summary>
/// The create.
/// </summary>
public void Create()
{
this.rangeDisplay = this.me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
this.rangeDisplay.SetControlPoint(1, new Vector3(255, 80, 50));
this.rangeDisplay.SetControlPoint(3, new Vector3(20, 0, 0));
this.lastRange = this.GetAttackRange();
this.rangeDisplay.SetControlPoint(2, new Vector3(this.lastRange, 255, 0));
}
示例10: RenderEffect
/// <summary>
/// Renders the specified ParticleEffect.
/// </summary>
public virtual void RenderEffect(ParticleEffect effect)
{
Guard.ArgumentNull("effect", effect);
Matrix ident = Matrix.Identity;
this.RenderEffect(effect, ref ident);
}
示例11: DrawLine
private static void DrawLine(Vector3 position, float size, int directionf, int directionu)
{
var effect = new ParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf", position);
ParticleEffects.Add(effect);
effect.SetControlPoint(1, new Vector3(0, 125, 0));
effect.SetControlPoint(2, new Vector3(size, 255, 0));
effect.SetControlPointOrientation(4, new Vector3(directionf, 0, 0), new Vector3(directionu, 0, 0), new Vector3(0, 0, 0));
}
示例12: RenderEffect
/// <summary>
/// Renders the specified ParticleEffect.
/// </summary>
public void RenderEffect(ParticleEffect effect, SpriteBatch spriteBatch)
{
Guard.ArgumentNull("effect", effect);
Guard.ArgumentNull("spriteBatch", spriteBatch);
for (int i = 0; i < effect.Count; i++)
this.RenderEmitter(effect[i], spriteBatch);
}
示例13: Tracker
public Tracker(Entity v,ParticleEffect ef)
{
V = v;
Ef = ef;
/*Game.OnUpdate += args =>
{
Printer.Print($"{ef.Name}/{ef.IsDestroyed}/{ef.IsManaged}/{ef.IsValid}/{ef.RefCount}");
};*/
}
示例14: Ward
protected Ward(Vector3 position, string abilityName)
{
Position = position;
RequiresUpdate = true;
TextureSize = new Vector2(50, 35);
if (Menu.RangeEnabled(abilityName))
{
ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
}
}
示例15: Init
public static void Init()
{
gameLoad = false;
isInCombo = false;
isAABest = false;
lastHitting = false;
rangesAA = null;
rangesW = null;
Orbwalking.Load();
/*pippyFont = new Font(Drawing.Direct3DDevice9,
20,
0,
FontWeight.Bold,
0,
false,
FontCharacterSet.Default,
FontPrecision.Default,
FontQuality.Antialiased,
FontPitchAndFamily.Default,
"Tahoma");
*/
//Events
Game.OnUpdate += DRangerUpdate;
Game.OnWndProc += DRangerWnd;
Drawing.OnDraw += DRangerDraw;
}