本文整理汇总了C#中ParticleSystem.Init方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.Init方法的具体用法?C# ParticleSystem.Init怎么用?C# ParticleSystem.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSystem
的用法示例。
在下文中一共展示了ParticleSystem.Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init()
{
system = new ParticleSystem(6);
system.Position = new Point(300, 190);
switch (Color) {
case Color.Red:
system.StartColor = new int[] {163, 0, 0, 1};
system.EndColor = new int[] {220, 0, 0, 1};
break;
case Color.Blue:
system.StartColor = new int[] {0, 0, 255, 1};
system.EndColor = new int[] {0, 0, 173, 1};
break;
case Color.Green:
system.StartColor = new int[] {53, 244, 73, 1};
system.EndColor = new int[] {23, 104, 31, 1};
break;
case Color.Yellow:
system.StartColor = new int[] {255, 212, 0, 1};
system.EndColor = new int[] {145, 121, 0, 1};
break;
}
system.Size = 30;
system.SizeRandom = 2;
system.MaxParticles = 30;
system.LifeSpan = 5;
system.Speed = 1;
system.Gravity = new DoublePoint(0, 0);
system.Init();
curSpeed = system.Speed;
}
示例2: Init
public void Init()
{
system = new ParticleSystem(5);
system.Position = new Point(300, 190);
system.StartColor = new int[] {255, 0, 0, 1};
system.EndColor = new int[] {127, 55, 0, 1};
system.Size = 20;
system.MaxParticles = 25;
system.LifeSpan = 25;
system.Init();
}
示例3: AddProjectile
public void AddProjectile(int x, int y)
{
var proj = new ParticleSystem(6);
proj.Position = system.Position.Clone();
proj.StartColor = new int[] {127, 0, 0, 1};
proj.EndColor = new int[] {127, 55, 0, 1};
proj.Size = 15;
proj.MaxParticles = 25;
proj.LifeSpan = 25;
double angle = Math.Atan2(-y - proj.Position.Y, -x - proj.Position.X) / Math.PI * 180 + 180;
proj.Angle = (int) ( angle );
proj.AngleRandom = 10;
proj.MaxEmitted = 10;
proj.Speed = 10;
proj.Gravity = new DoublePoint(0, 0);
proj.Init();
projectiles.Add(proj);
}
示例4: Init
public void Init()
{
systems = new List<ParticleSystem>();
var items = new List<Point>(Map.Travel(50, myScale, false));
for (int index = 0; index < items.Count; index++) {
var point = items[index];
var system = new ParticleSystem(3);
int[] StartColors = null;
int[] EndColors = null;
int[] StartColors2 = null;
int[] EndColors2 = null;
switch (StartColor) {
case Color.Red:
StartColors = new int[] {163, 0, 0, 1};
EndColors = new int[] {220, 0, 0, 1};
break;
case Color.Blue:
StartColors = new int[] {0, 0, 255, 1};
EndColors = new int[] {0, 0, 173, 1};
break;
case Color.Green:
StartColors = new int[] {53, 244, 73, 1};
EndColors = new int[] {23, 104, 31, 1};
break;
case Color.Yellow:
StartColors = new int[] {255, 212, 0, 1};
EndColors = new int[] {145, 121, 0, 1};
break;
}
switch (EndColor) {
case Color.Red:
StartColors2 = new int[] {163, 0, 0, 1};
EndColors2 = new int[] {220, 0, 0, 1};
break;
case Color.Blue:
StartColors2 = new int[] {0, 0, 255, 1};
EndColors2 = new int[] {0, 0, 173, 1};
break;
case Color.Green:
StartColors2 = new int[] {53, 244, 73, 1};
EndColors2 = new int[] {23, 104, 31, 1};
break;
case Color.Yellow:
StartColors2 = new int[] {255, 212, 0, 1};
EndColors2 = new int[] {145, 121, 0, 1};
break;
}
StartColors[0] = (int) ( StartColors[0] + ( StartColors2[0] - StartColors[0] ) * ( (double) index / items.Count ) );
StartColors[1] = (int) ( StartColors[1] + ( StartColors2[1] - StartColors[1] ) * ( (double) index / items.Count ) );
StartColors[2] = (int) ( StartColors[2] + ( StartColors2[2] - StartColors[2] ) * ( (double) index / items.Count ) );
StartColors[3] = (int) ( StartColors[3] + ( StartColors2[3] - StartColors[3] ) * ( (double) index / items.Count ) );
EndColors[0] = (int) ( EndColors[0] + ( EndColors2[0] - EndColors[0] ) * ( (double) index / items.Count ) );
EndColors[1] = (int) ( EndColors[1] + ( EndColors2[1] - EndColors[1] ) * ( (double) index / items.Count ) );
EndColors[2] = (int) ( EndColors[2] + ( EndColors2[2] - EndColors[2] ) * ( (double) index / items.Count ) );
EndColors[3] = (int) ( EndColors[3] + ( EndColors2[3] - EndColors[3] ) * ( (double) index / items.Count ) );
system.StartColor = StartColors;
system.EndColor = EndColors;
system.Size = 9;
system.MaxParticles = 4;
system.LifeSpan = 11;
system.LifeSpanRandom = 2;
system.Speed = 1;
system.Gravity = new DoublePoint(0, 0);
system.Position = point;
system.Init();
systems.Add(system);
}
}