Commit 04cc05dc authored by Maxime's avatar Maxime
Browse files

fix particles not following camera

parent c833734a
......@@ -3,7 +3,7 @@
<texture name="particule.png"/>
<sourcePosition x="0.00" y="0.00"/>
<sourcePositionVariance x="0.00" y="0.00"/>
<speed value="8000.00"/>
<speed value="4000.00"/>
<speedVariance value="0.00"/>
<particleLifeSpan value="5.0000"/>
<particleLifespanVariance value="0.7000"/>
......@@ -19,9 +19,9 @@
<finishColor red="0.00" green="0.50" blue="1.00" alpha="0.80"/>
<finishColorVariance red="0.00" green="0.00" blue="0.40" alpha="0.20"/>
<maxParticles value="1200"/>
<startParticleSize value="25.00"/>
<startParticleSize value="20.00"/>
<startParticleSizeVariance value="2.00"/>
<finishParticleSize value="25.00"/>
<finishParticleSize value="20.00"/>
<FinishParticleSizeVariance value="5.00"/>
<duration value="-1.00"/>
<emitterType value="0"/>
......
......@@ -3,7 +3,7 @@
<texture name="particule.png"/>
<sourcePosition x="0.00" y="0.00"/>
<sourcePositionVariance x="0.00" y="0.00"/>
<speed value="8000.00"/>
<speed value="4000.00"/>
<speedVariance value="0.00"/>
<particleLifeSpan value="5.0000"/>
<particleLifespanVariance value="0.7000"/>
......@@ -19,9 +19,9 @@
<finishColor red="0.00" green="0.50" blue="1.00" alpha="0.80"/>
<finishColorVariance red="0.00" green="0.00" blue="0.40" alpha="0.20"/>
<maxParticles value="1200"/>
<startParticleSize value="25.00"/>
<startParticleSize value="20.00"/>
<startParticleSizeVariance value="2.00"/>
<finishParticleSize value="25.00"/>
<finishParticleSize value="20.00"/>
<FinishParticleSizeVariance value="5.00"/>
<duration value="-1.00"/>
<emitterType value="0"/>
......
......@@ -19,7 +19,7 @@ namespace ZZZZZZ.GUI
{
case Key.F3:
AppConfig.Current.DrawDebug = !AppConfig.Current.DrawDebug;
//GameManager.Current.Camera.Zoom = AppConfig.Current.DrawDebug ? 1 : 4.2f;
GameManager.Current.Camera.Zoom = AppConfig.Current.DrawDebug ? 1 : 4.2f;
break;
case Key.F10:
Task.Run(() => GameManager.Current.Exit());
......
......@@ -9,15 +9,17 @@ namespace ZZZZZZ.Particles
{
public class BackgroundParticleEmitter : ParticleEmitter2D
{
private readonly IntVector2 topLeft;
private readonly IntVector2 bottomRight;
private readonly Vector2 topLeft;
private readonly Vector2 bottomRight;
private readonly Vector3 middle;
public BackgroundParticleEmitter()
{
GameManager.Current.Scene.CreateChild("BackgroundParticleEmitter").AddComponent(this);
Effect = Application.Current.ResourceCache.GetParticleEffect2D(Assets.Particles.Background);
topLeft = new IntVector2(-15, 13);
bottomRight = new IntVector2(20, -8);
topLeft = new Vector2(0, 0);
bottomRight = new Vector2(7.68f, -4.80f);
middle = new Vector3(7.68f, 4.80f, 0) / 2;
Enabled = false;
ProcessGravity();
......@@ -51,19 +53,19 @@ namespace ZZZZZZ.Particles
switch (GameManager.Current.Scene.Gravity)
{
case GravityDirection.Bas:
Node.Position = GameManager.Current.Camera.Node.Position - middle + new Vector3(ToolBox.RandomFloat(topLeft.X, bottomRight.X), topLeft.Y + 4.80f, 0);
Effect.Angle = -90;
Node.Position = new Vector3(ToolBox.RandomFloat(topLeft.X, bottomRight.X), topLeft.Y, 0);
break;
case GravityDirection.Haut:
Node.Position = GameManager.Current.Camera.Node.Position - middle + new Vector3(ToolBox.RandomFloat(topLeft.X, bottomRight.X), bottomRight.Y, 0);
Effect.Angle = 90;
Node.Position = new Vector3(ToolBox.RandomFloat(topLeft.X, bottomRight.X), bottomRight.Y, 0);
break;
case GravityDirection.Gauche:
Node.Position = new Vector3(bottomRight.X, ToolBox.RandomFloat(topLeft.Y, bottomRight.Y), 0);
Node.Position = GameManager.Current.Camera.Node.Position - middle + new Vector3(bottomRight.X, ToolBox.RandomFloat(topLeft.Y, bottomRight.Y) + 4.80f, 0);
Effect.Angle = 180;
break;
case GravityDirection.Droite:
Node.Position = new Vector3(topLeft.X, ToolBox.RandomFloat(topLeft.Y, bottomRight.Y), 0);
Node.Position = GameManager.Current.Camera.Node.Position - middle + new Vector3(topLeft.X, ToolBox.RandomFloat(topLeft.Y, bottomRight.Y) + 4.80f, 0);
Effect.Angle = 0;
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment