Exemple #1
0
        public void LoadContent(ContentLoader content)
        {
            myEffect = content.ContentManager.Load<ParticleEffect>(name);

            myEffect.LoadContent(content.ContentManager);
            myEffect.Initialise();
            myRenderer.LoadContent(content.ContentManager);
        }
 public LightCausingParticleObject(ParticleEffect effect, Renderer partilceRenderer, PointLight pointLight, ICollidableTile trackingObject)
 {
     Enabled = true;
     Effect = effect;
     Light = pointLight;
     TrackingObject = trackingObject;
     m_particleRenderer = partilceRenderer;
 }
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {
                Emitters = new EmitterCollection
                                {            
                                     new PointEmitter
                                        {
                                            Budget = 32,
                                            Term = 1.0f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.BulletTrail"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 0.0f, Green = 0.5f, Blue = 0.1f },
                                            ReleaseOpacity = 0.0f,
                                            ReleaseQuantity = 1,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 1.5f)
                                                                },
                                            ReleaseScale = new Range(20f, 20f),
                                            ReleaseSpeed = new Range(0f, 100f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new ScaleInterpolator3
                                                                {
                                                                      FinalScale = 0f,
                                                                      InitialScale = 20f,
                                                                      Median = 0.25f,
                                                                      MedianScale = 20f
                                                                },

                                                                new ColourInterpolator2
                                                                    {
                                                                         FinalColour = new Vector3(1f, 0.25f, 0f),
                                                                         InitialColour = new Vector3(0f, 0.5f, 1f)
                                                                    },

                                                                new OpacityInterpolator3
                                                                {
                                                                     InitialOpacity = 0.0f,
                                                                     FinalOpacity = 0.5f,
                                                                     Median = 0.1f,
                                                                     MedianOpacity = 1.0f                                                                      
                                                                }
                                                            },
                                        },                           
                                },
            };

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
            }

            return effect;
        }
        public override void Initialise()
        {
            base.Initialise();

            m_ParticleEffect = LoadParticleEffect(m_Name);

            if (m_ParticleEffect != null)
                m_ParticleEffect.Initialise();
        }
 public Bullet(Texture2D texture, Vector2 center, float speed, int pDamage, ParticleEffect pEffect)
     : base(texture, center, Anchor.CENTER)
 {
     this.speed = speed;
     mDamage = pDamage;
     mEffect = pEffect;
     mHit = false;
     layer_depth = 0.55f;
 }
Exemple #6
0
 public ParticleEntity(Screen.GameScreen screen, string effectName)
     : base(screen)
 {
     abyss = screen.Game;
     gameScreen = screen;
     Effect = abyss.Content.Load<ParticleEffect>(effectName).DeepCopy();
     Effect.Initialise();
     Effect.LoadContent(abyss.Content);
 }
        /// <summary>
        /// Saves a particle effect to disk.
        /// </summary>
        /// <param name="effect">The particle effect to be saved.</param>
        /// <param name="filename">The name of the file to save to.</param>
        static public void Export(ParticleEffect effect, string filename)
        {
            Stream output = File.OpenWrite(filename);

            BinaryFormatter formatter = new BinaryFormatter();

            formatter.Serialize(output, effect);

            output.Close();
        }
        public void LoadContent(ContentManager content)
        {
            flameEffect = content.Load<ParticleEffect>("Particles\\flameEffect");
            flameEffect.LoadContent(content);
            flameEffect.Initialise();
            explosionEffect = content.Load<ParticleEffect>("Particles\\explosionEffect");
            explosionEffect.LoadContent(content);
            explosionEffect.Initialise();

            particleRenderer.LoadContent(content);
        }
        protected override void LoadContent()
        {
            _particleEffect = Content.Load<ParticleEffect>("Demo1");

            foreach (var emitter in _particleEffect.Emitters)
            {
                emitter.ParticleTexture = Content.Load<Texture2D>("Star");
                emitter.Initialise();
            }
            _spriteBatchRenderer.LoadContent(Content);
        }
        public void Initialize(ParticleEffect particleEffect)
        {

            midiSettingsControl.Initizalize();
            dataControl.Initialize(particleEffect);

            bindingEditorControl1.Initialize(this);

            midiSettingsControl.SelectionChanged += midiSettingsControl_MidiEventSelectionChanged;
            dataControl.SelectionChanged += new EventHandler(dataControl_SelectionChanged);

        }
Exemple #11
0
        public void LoadContent()
        {
            if (ContentLoaded)
                return;

            ParticleEffect model = EphemereGames.Core.Persistence.Persistence.GetAsset<Particle>(Name).Model;

            Model = model.DeepCopy();

            Model.Initialise();

            ContentLoaded = true;
        }
        public virtual ParticleEffect DeepCopy()
        {
            ParticleEffect effect = new ParticleEffect
            {
                Author = this.Author,
                Description = this.Description,
                Name = this.Name,
            };

            foreach (Emitter emitter in this)
                effect.Add(emitter.DeepCopy());

            return effect;
        }
Exemple #13
0
        public Box(Game game, Vector2 position)
            : base(game)
        {
            mContentManager = new ContentManager(game.Services);
            mWorld = (World)game.Services.GetService(typeof(World));
            mGraphics = (GraphicsDeviceManager)game.Services.GetService(typeof(GraphicsDeviceManager));
            mSpriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch));

            particleRenderer = new SpriteBatchRenderer
            {
                GraphicsDeviceService = mGraphics
            };
            particleEffect = new ParticleEffect();
        }
        public ParticleEffect CreateEffect(IResourceDictionary resourceDictionary)
        {
            var effect = new ParticleEffect
            {
                Emitters = new EmitterCollection
                                {            
                                     new PointEmitter
                                        {
                                            Name = "Sparks",
                                            Budget = 35,
                                            Term = 0.75f,                                            
                                            ParticleTexture = (Texture2D)resourceDictionary.GetResource("Zazumo.Textures.Particles.Sparks"),
                                            BlendMode = EmitterBlendMode.Alpha,
                                            ReleaseColour = new ColourRange { Red = 1f, Green = new Range(0.4f, 0.8f), Blue = 0f },
                                            ReleaseOpacity = 1.0f,
                                            ReleaseQuantity = 35,
                                            ReleaseRotation = new RotationRange 
                                                                {
                                                                    Roll = new Range(0f, 0f)
                                                                },
                                            ReleaseScale = new Range(3f, 7f),
                                            ReleaseSpeed = new Range(0f, 250f),
                                            
                                            Modifiers = new ModifierCollection
                                                            {
                                                                new OpacityInterpolator2
                                                                {
                                                                     FinalOpacity = 0f,
                                                                     InitialOpacity = 1f
                                                                },
                                                                
                                                                new DampingModifier
                                                                {
                                                                     DampingCoefficient = 2f
                                                                }
                                                            },
                                        },                           
                                },
            };

            effect.Emitters["Sparks"].Controllers.AddFirst(new CooldownController { CooldownPeriod = 5.0f });

            foreach (var emitter in effect.Emitters)
            {
                emitter.Initialise();
            }

            return effect;
        }
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            myRenderer = new SpriteBatchRenderer
            {
                GraphicsDeviceService = graphics
            };
            myEffect = new ParticleEffect();

            //graphics.PreferredBackBufferHeight = 600;

            //graphics.PreferredBackBufferWidth = 800;
        }
Exemple #16
0
        public override void Load(LoadManager content)
        {
            base.Load(content);

            mParticleEffect = MilkShake.ConentManager.Load<ParticleEffect>(mAssetURL).DeepCopy(); // Deep Copy to stop referances
            mParticleEffect.Initialise();

            foreach (Emitter emitter in mParticleEffect)
            {
                // Fix
                emitter.ParticleTexture = MilkShake.ConentManager.Load<Texture2D>("distort_part");
                if (!emitter.Initialised) emitter.Initialise();
                //EmitterBlendMode.
            }
        }
        public ParticleEffectComponent(Engine engine, string effectName, Vector2 initialPosition)
            : base(engine)
        {
            DrawParticleEffect = true;
              particleEffectName = effectName;
              this.Position = initialPosition;

              particleEffect = Engine.Content.Load<ParticleEffect>(@"ParticleEffects\" + particleEffectName);
              particleEffect.LoadContent(Engine.Content);
              particleEffect.Initialise();

              DrawOrder = int.MaxValue - 1;

              Engine.AddComponent(this);
        }
        protected override void LoadContent()
        {
            // Todo:
            // Load the particle effect called "Sun" and assign it to the _sunParticleEffect field. Load the texture called "TriangleParticle"
            //  and assign it to the ParticleTexture property of the first emitter in the _sunParticleEffect instance.
            _sunParticleEffect = Content.Load<ParticleEffect>("Sun");
            var triangleTexture = Content.Load<Texture2D>("TriangleParticle");

            _sunParticleEffect[0].ParticleTexture = triangleTexture;
            _sunParticleEffect.Initialise();
            // Hint:
            // In Mercury, you can access the emitters of a particle system using array notation, i.e.
            //  emitter[0], emitter[1] etc.
            // This is just because of the way Mercury implements the ParticleEffect class. Its not something you need to know right now, but
            //  it inherits from a collection class which overloads the [] operator.
        }
Exemple #19
0
        /// <summary>
        ///   Load all XNA <see cref = "ContentManager" /> content
        /// </summary>
        /// <param name = "catalogue"></param>
        /// <param name = "manager">XNA content manage</param>
        public void LoadContent(IContentCatalogue catalogue, ContentManager manager)
        {
            if (!string.IsNullOrEmpty(_particleEffectFilePath))
            {
                Effect = manager.Load<ParticleEffect>(_particleEffectFilePath).DeepCopy();
            }

            if (Effect != null)
            {
                foreach (AbstractEmitter emitter in Effect.Emitters)
                {
                    emitter.ParticleTexture = manager.Load<Texture2D>(emitter.ParticleTextureAssetPath);
                    if (!emitter.Initialised)
                        emitter.Initialise();
                }
            }
        }
Exemple #20
0
        private float mSpeedTimerInSeconds = 3.5f; // Increase ball speed every 3.5 seconds

        #endregion Fields

        #region Constructors

        public Ball(Texture2D texture,
            Vector2 position,
            World world,
            DebugViewXNA debugViewXNA,
            ContentManager content,
            GraphicsDeviceManager graphics)
            : base(world, debugViewXNA, content, graphics)
        {
            this.mTexture = texture;
            this.mWidth = ConvertUnits.ToSimUnits(this.mTexture.Width);
            this.mHeight = ConvertUnits.ToSimUnits(this.mTexture.Height);
            this.mOrigin = new Vector2(this.mWidth / 2f, this.mHeight / 2f);

            this.mSpriteEffects = SpriteEffects.None;

            this.mPosition = ConvertUnits.ToSimUnits(position);

            this.mBody = BodyFactory.CreateCircle(this.mWorld,
               this.Radius,
               0.5f,
               this.mPosition);

            this.mBody.BodyType = BodyType.Dynamic;
            this.mBody.Restitution = 1f;
            this.mBody.Friction = 0;
            this.mBody.Inertia = float.MaxValue;

            this.mBody.OnCollision += new OnCollisionEventHandler(OnCollision);
            this.mBody.OnSeparation += new OnSeparationEventHandler(OnSeparation);
            this.mWorld.ContactManager.OnBroadphaseCollision += OnBroadphaseCollision;
            this.mBody.FixtureList[0].AfterCollision += new AfterCollisionEventHandler(OnAfterCollision);

            this.mParticleRenderer = new SpriteBatchRenderer
            {
                GraphicsDeviceService = this.mGraphics
            };

            this.mParticleEffect = new ParticleEffect();

            this.mParticleRenderer.LoadContent(this.mContent);
            this.mParticleEffect = this.mContent.Load<ParticleEffect>(@"Effects\basicSparks");
            this.mParticleEffect.LoadContent(this.mContent);
            this.mParticleEffect.Initialise();

            this.LoadContent();
        }
Exemple #21
0
        public Game1()
        {
            this.Window.Title = "Particles Test";

            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            //this.effect = new ParticleEffect(this);

            //this.controller = new TestController(this, .0001f);
            //this.effect.Controllers.Add(this.controller);

            //this.emitter = new CircleEmitter(15000, 60f, 300f, true);
            //this.emitter.ReleaseQuantity = 25;
            //this.emitter.ParticleSpeed = 0f;
            //this.emitter.ParticleSpeedVariation = 0f;
            //this.controller.Emitter = this.emitter;
            //this.effect.Emitters.Add(this.emitter);

            //this.color = new ColorModifier(Color.Chartreuse, Color.OrangeRed, .5f, Color.RoyalBlue);
            //this.emitter.Modifiers.Add(this.color);

            //this.opacity = new OpacityModifier(1f, 1f, .9f, 0f);
            //this.emitter.Modifiers.Add(this.opacity);

            //this.scale = new ScaleModifier(32f, 32f);
            //this.emitter.Modifiers.Add(this.scale);

            //this.renderer = new BasicRenderer(this, this.graphics, this.emitter.Budget);
            //this.effect.Renderer = this.renderer;

            ////this.emitter.Modifiers.Add(new RadialGravityModifier(new Vector2(512f, 384f), 5000f, 100f));
            //this.emitter.Modifiers.Add(new VortexModifier(new Vector2(312f, 384f), 150f, 500f, true));
            //this.emitter.Modifiers.Add(new VortexModifier(new Vector2(712f, 384f), 150f, 500f, false));
            //this.emitter.Modifiers.Add(new DampingModifier(.25f));

            this.IsMouseVisible = true;
            this.graphics.PreferredBackBufferWidth = 1024;
            this.graphics.PreferredBackBufferHeight = 768;

            //MercuryLoader.Export(this.effect, "fx.pfx");
            this.effect = MercuryLoader.Import(this, "fx.pfx");
        }
Exemple #22
0
        /// <summary>
        /// Construct a world.
        /// </summary>
        /// <param name="game">Game associated with this world</param>
        /// <param name="worldSize">Size of the world.</param>
        public World(Game game, Vector2 worldSize, Texture2D mapBackground, 
            Texture2D[] bulletPathTextures, Texture2D[] powerUpTextures, Texture2D[] shopTextures,
            SoundBank weaponSounds, ParticleEffect[] particleEffects)
        {
            this.WorldSize = worldSize;
            this.bulletPathTextures = bulletPathTextures;
            this.powerUpTextures = powerUpTextures;
            this.weaponSounds = weaponSounds;
            this.particleEffects = particleEffects;
            this.shopTextures = shopTextures;
            this.mapBackground = mapBackground;

            testingBlocksList = new List<TestingBlock>();
            shopAreas = new List<ShopArea>();
            basicCarList = new List<BasicCar>();
            playerList = new List<Player>();
            enemyList = new List<Enemy>();
            bulletList = new List<Bullet>();
            powerUpList = new List<PowerUp>();
        }
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // load particle effects
            myEffect = Content.Load<ParticleEffect>(@"EffectLibrary\CampFire");
            myEffect.LoadContent(this.Content);
            myEffect.Initialise();
            myRenderer.LoadContent(Content);

            shipCannon = new GameObject(Content.Load<Texture2D>("Sprites\\shipCannon"));

            HUD = Content.Load<SpriteFont>("Fonts\\HUD");

            meteorTexture = Content.Load<Texture2D>("Sprites\\meteoro_teste");
            //meteorTexture = Content.Load<Texture2D>("Sprites\\1");

            Debug = Content.Load<SpriteFont>("Fonts\\Score");

            Fundo = Content.Load<Texture2D>("Sprites\\background");

            shipCannon2 = new GameObject(Content.Load<Texture2D>("Sprites\\shipCannon"));

            elementoBen = new elementoBenefico(Content.Load<Texture2D>("Sprites\\insgrocha"), Content.Load<Texture2D>("Sprites\\insignacoracao"));

            shipCannon2.position = new Vector2(Window.ClientBounds.Width / 2 - shipCannon.sprite.Width / 2 + 110,
               Window.ClientBounds.Height - 100);

            shipCannon.position = new Vector2(Window.ClientBounds.Width / 2 - shipCannon.sprite.Width / 2 - 80,
                Window.ClientBounds.Height - 100);

            meteorTextureDB =
               new Color[meteorTexture.Width * meteorTexture.Height];
            meteorTexture.GetData(meteorTextureDB);
        }
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Create new renderer and set its graphics devide to "this" device
            myRenderer = new SpriteBatchRenderer
            {
                GraphicsDeviceService = graphics
            };
            myEffect = new ParticleEffect();

            //graphics.IsFullScreen = true;

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="location"></param>
 public ParticleComponent_cl(Entity_cl parent, Vector2 location)
     : base(parent)
 {
     particle = new ParticleEffect();
     particlelocation = location;
 }
        /// <summary>C:\Users\John Getty\Desktop\MPE\ParticleTextures\Particle001.png
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _renderer =new BillboardRenderer {GraphicsDeviceService = _graphics};

            var colors = new[]
                                   {
                                       Color.Pink.ToVector3(), Color.Yellow.ToVector3(), Color.Lavender.ToVector3(),
                                       Color.Salmon.ToVector3()
                                   };
            _manager = new ParticleEffectManager(_renderer);
            for (int i = 0; i < 4; i++)
            {
                _emitters[i] = new SphereEmitter
                                   {
                                       Radius = 10,
                                       Radiate = true,
                                       Budget = 16384,
                                       ReleaseColour = colors[i],
                                       ReleaseQuantity = 50/(i+1),
                                       BlendMode = EmitterBlendMode.Add,
                                       ReleaseSpeed =  .2f * (4-i),
                                       ReleaseOpacity = .1f,
                                       ReleaseScale = (i+1) * 5 *.02f,
                                       Term = 1,
                                   };

                if (i==1)
                {
                    _emitters[i].Modifiers.Add(new LinearGravityModifier { Gravity = new Vector3(-2, -2, 0) });
                    _emitters[i].Modifiers.Add(new OpacityModifier {Initial = 0.2f, Ultimate = 0f});
                }
                if (i==2)
                {
                    _emitters[i].Modifiers.Add(new LinearGravityModifier { Gravity = new Vector3(1, -1, 0) });
                    _emitters[i].Modifiers.Add(new ColourModifier
                                                   {
                                                       InitialColour = Color.Red.ToVector3(),
                                                       UltimateColour = Color.White.ToVector3()
                                                   });
                    _emitters[i].Modifiers.Add(new OpacityModifier {Initial = 0.4f, Ultimate = 0f});
                   
                }
            }
            _effect = new ParticleEffect { _emitters[0], _emitters[1], _emitters[2], _emitters[3] };
            _effect.Initialise();

            _manager.Add(_effect);



            _projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, _graphics.GraphicsDevice.Viewport.AspectRatio, 1f, 500f);


            base.Initialize();
        }
Exemple #27
0
        public Paddle(Texture2D texture,
            Vector2 position,
            World world,
            DebugViewXNA debugViewXNA,
            ContentManager content,
            GraphicsDeviceManager graphics)
            : base(world, debugViewXNA, content, graphics)
        {
            this.mTexture = texture;
            this.mWidth = ConvertUnits.ToSimUnits(this.mTexture.Width);
            this.mHeight = ConvertUnits.ToSimUnits(this.mTexture.Height);
            this.mOrigin = new Vector2(this.mWidth / 2f, this.mHeight / 2f);

            this.mSpriteEffects = SpriteEffects.None;

            this.mPosition = ConvertUnits.ToSimUnits(position);

            this.mBody = BodyFactory.CreateRectangle(this.mWorld,
                this.mWidth,
                this.mHeight,
                1f,
                this.mPosition);

            this.mBody.BodyType = BodyType.Dynamic;

            this.mJointWorldAnchor = this.mPosition;

            this.mFixedPrismJoint = new FixedPrismaticJoint(this.mBody,
                 this.mJointWorldAnchor,
                 this.mJointAxis);

            this.mFixedPrismJoint.LimitEnabled = true;
            this.mFixedPrismJoint.LowerLimit = this.mJointLowerLimit;
            this.mFixedPrismJoint.UpperLimit = this.mJointUpperLimit;
            this.mFixedPrismJoint.Enabled = true;
            this.mWorld.AddJoint(this.mFixedPrismJoint);

            this.mBody.OnCollision += new OnCollisionEventHandler(OnCollision);
            this.mBody.OnSeparation += new OnSeparationEventHandler(OnSeparation);
            this.mBody.FixtureList[0].AfterCollision += new AfterCollisionEventHandler(OnAfterCollision);

            this.mParticleRenderer = new SpriteBatchRenderer
            {
                GraphicsDeviceService = this.mGraphics
            };

            this.mParticleEffect = new ParticleEffect();

            this.mParticleRenderer.LoadContent(this.mContent);
            this.mParticleEffect = this.mContent.Load<ParticleEffect>(@"Effects\basicSparks");
            this.mParticleEffect.LoadContent(this.mContent);
            this.mParticleEffect.Initialise();
        }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            
            
            switch (currentState)
            {
                     
                #region Menu
		 
	            case States.Menu: 

                    //Platz für ein Menu
                    //Menu();
                    prewState = States.Menu;
                    currentState = States.Start;
                    break;

                    #endregion

                #region Start
                //Start: Objekte werden geladen, Kamera wird erstellt, danach Camto1
                case States.Start:

                    startObjects.LoadStartObjects(level.getLevel());

                    //Zeigt das Baumenü mit den Objekten und Texturen die der Spieler wählen kann, benötigt Name des Bildes
                    auswahlanzeige = startObjects.showObjects("Bau");
                    objWafC = startObjects.LoadObjWafC();

                    //setzt die Variable PosX1 auf die Position bevor er in den nächsten State wechselt
                    PosX1 = Scene.Camera.Position.X;
                    Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                    aktuallisiereZeit(gameTime);

                    //danach Kamera an Spielerposition 1 bewegen
                    prewState = States.Start;
                    currentState = States.Camto1;

                    break;

                #endregion

                #region Camto1
                //Camto1: Kamera wird an die Linke Position bewegt
                case States.Camto1:
                    aktuallisiereZeit(gameTime);
                    weiterSym.Visible = false;
                    detecting = false;  //Kinect deaktiviert

                    //Variable wird für nächste Schussphasen zurückgesetzt
                    firedWaffen = 0;                        
                    
                    //Kamera wird bewegt
                    cameraMovement.move(zeit,3000,PosX1, level.getSpieler1Pos());

                #region Übergangsbedingungen
                    //Wenn die Spielerposition 1 erreicht wurde startet die Bauphase/Schussphase
                    if (Scene.Camera.Position.X == level.getSpieler1Pos())
                    {
                        //setzt die Variable PosX1 auf die Position bevor er in den nächsten State wechselt 
                        PosX1 = Scene.Camera.Position.X;
                        Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                        aktuallisiereZeit(gameTime);

                        //Wenn wir aus der Startphase kommen, -> Bauphase 1
                        if (prewState == States.Start)
                        {
                            prewState = States.Camto1;
                            currentState = States.Bauphase1O;
                        }

                        //Wenn wir aus der Bauphase von Spieler2 kommen, -> Schussphase 1
                        else if (prewState == States.Bauphase2O)
                        {
                            prewState = States.Camto1;
                            currentState = States.Schussphase1;
                        }

                        //Wenn wir aus der Schussphase von Spieler2 kommen
                        else if (prewState == States.Schussphase2)
                        {
                            //Ist die Schussphase durch -> Bauphase 1
                            if (schussphasenDurch)
                            {
                                prewState = States.Camto1;
                                currentState = States.Schussphase1;
                                /* schussphasenDurch wird auf true gesetzt, damit nach der nächsten Schussphase wieder in die Bauphase gewechselt wird.
                                 * Schussphase2 sagt also schussphaseDurch= true, will aber erst noch Schussphase 1
                                 */

                            }
                            //sonst Schussphase 1
                            else
                            {
                                prewState = States.Camto1;
                                currentState = States.Bauphase1O;
                            }
                        }
                    } 
                #endregion

                    break;

                #endregion

                #region Objektemenüs
                case States.Bauphase2O:

                case States.Bauphase1O:
                    aktuallisiereZeit(gameTime);
                    detecting = true;               //Kinect aktiv
                    if (!weiterSym.Visible)
                    {
                        weiterSym.Visible = true;
                    }
                    float pos;
                    

                    #region Spieler &  Spielerposition
                    if (currentState == States.Bauphase1O)
                    {
                        gamer = spieler1;
                        pos = level.getSpieler1Pos();
                        weiterSym.Position = new Vector3(pos+1.13f, -0.7f, -2f);
                    }
                    else
                    {
                        gamer = spieler2;
                        pos = level.getSpieler2Pos();
                        weiterSym.Position = new Vector3(pos + 1.13f, -0.7f, -2f);
                    }
                    #endregion

                    #region Objekt erzeugen und mit Hand positionieren
                    if (!showWaffe)
                    {
                        if (getObj && objInHand == false && auswahl != 0 && auswahl < 5)    //"klick" und das Objekt wurde noch nicht erstellt und linke hand befindet sich auf auswahlfeld
                        {
                            objInHand = true;                                               //soll jetzt der Hand folgen
                            aktuellesObj = Objektverwaltung.createObj(auswahl, gamer, pos); //aktuelles Objekt wird erzeugt
                        }

                        if (objInHand)//Ausrichten des Obj
                        {
                            Vector3 rH = new Vector3(rightHand.Position.X, rightHand.Position.Y, -5f); //Handvektor ohne Tiefenveränderung
                            aktuellesObj.setPosition(rH);                 //Objektposition wird auf Handgelegt

                            Objektverwaltung.orientObj(aktuellesObj, leftHand.Position.X, leftHand.Position.Y);

                            rightHand.Visible = false;                  //Anzeige der rechten Hand deaktiviert
                        }

                        if (klick && objInHand == true)                //wenn sich ein Objekt in der Hand befindet und erneut geklickt wird
                        {
                            rightHand.Visible = true;                   //Rechte Hand wird wieder angezeigt
                            klick = false;
                            objInHand = false;                          //Bekommt nicht mehr die Posiotion der hand -> fällt

                            if (currentState == States.Bauphase1O)
                            {
                                prewState = States.Bauphase1O;              //Statewechsel
                                currentState = States.Bauphase1T;
                            }
                            else
                            {
                                prewState = States.Bauphase2O;
                                currentState = States.Bauphase2T;
                            }
                        }
                    }
                    #endregion

                    #region Waffe erzeugen und mit Hand positionieren
                    if (showWaffe)
                    {


                        if (getObj && objInHand == false && auswahl != 0 && auswahl < 5)    //"klick" und die Waffe wurde noch nicht erstellt und linke hand befindet sich auf auswahlfeld
                        {
                            objInHand = true;                                                   //soll jetzt der Hand folgen

                            aktuelleWaffe = Objektverwaltung.createWaffe(auswahl, gamer, rightHand.Position);  //aktuelles Objekt wird erzeugt
                            if (spieler1 == gamer)
                            {
                                spieler1.setWaffen(aktuelleWaffe);                                          //Waffe der Waffenliste des Spieler hinzufügen
                            }
                            else
                            {
                                spieler2.setWaffen(aktuelleWaffe);
                            }
                        }

                        
                        if (objInHand && showWaffe == true)                                              //Ausrichten der Waffe
                        {
                            Vector3 rH = new Vector3(rightHand.Position.X, rightHand.Position.Y, -5f);  //Handvektor ohne Tiefenveränderung
                            aktuelleWaffe.setPosition(rH);                                              //Waffenposition wird auf Handgelegt
                            
                            rightHand.Visible = false;                                                  //Anzeige der rechten Hand deaktiviert
                            
                        }

                        if (klick && objInHand)                                                         //wenn sich ein Objekt in der Hand befindet und erneut geklickt wird
                        {
                            rightHand.Visible = true;                                                   //Rechte Hand wird wieder angezeigt
                            klick = false;
                            objInHand = false;
                            
                        }

                    }
                    
                    #endregion

                    #region Wechsel von der Objekt zur Waffenauswahl
                    if (klick&&objInHand == false && auswahl == 5 && showWaffe == false) //"klick" und das Objekt wurde noch nicht erstellt und linke hand befindet sich auf auswahlfeld
                    {
                        showWaffe = true;
                    }
                    else if (klick && objInHand == false &&  auswahl == 5 && showWaffe)
                    {
                        showWaffe = false;
                    }
                    #endregion
                    
                    #region Übergangsbedingungen
                    //Wenn Spieler nicht ausreichend Geld hat (oder auf weiter Klickt => in Kinect realisiert)
                    if (gamer.getMoney() < level.getMinMoney() && objInHand == false)
                    {
                        PosX1 = Scene.Camera.Position.X;
                        Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                        aktuallisiereZeit(gameTime);

                        if (currentState == States.Bauphase1O)
                        {
                            prewState = States.Bauphase1O;
                            if (spieler2.getMoney() < level.getMinMoney() && spieler2.getMoney() < spieler1.getMoney())
                            {
                                currentState = States.Schussphase1;
                            }
                            else
                            {
                                currentState = States.Camto2;
                            }
                        }
                        else //Bauphase2O
                        {
                            prewState = States.Bauphase2O;
                            if (spieler1.getMoney() < spieler2.getMoney())
                            {
                                currentState = States.Schussphase2;
                            }
                            else
                            {
                                currentState = States.Camto1;
                            }
                        }
                    }
                    #endregion
                    
                    break;

                #endregion

                #region Texturenmenüs
                //Bauphase, Spiele 1, Objekte erstellen
                case States.Bauphase1T:
                case States.Bauphase2T:
                    aktuallisiereZeit(gameTime);
                    Objektverwaltung.firstMaterial(aktuellesObj, auswahl);
                    weiterSym.Visible = false;

                    if (currentState == States.Bauphase1T)
                    {
                        gamer = spieler1;
                    }
                    else 
                    {
                        gamer = spieler2;
                    }

                    if (klick) //Übergang wird mit klick erzeugt
                    {
                        #region Kosten dem Spieler abziehen
                        if (aktuellesObj.getMaterial() == "MHolz")
                        { } //kostenlos
                        else if (aktuellesObj.getMaterial() == "MStein")
                        {
                            gamer.setMoney(spieler1.getMoney() - 50);
                        }
                        else if (auswahl == 3)
                        {
                            gamer.setMoney(spieler1.getMoney() - 100);
                        }
                        else if (auswahl == 4)
                        {
                            gamer.setMoney(spieler1.getMoney() - 200);
                        }
                        #endregion

                        if (currentState == States.Bauphase1T)
                        {
                            prewState = States.Bauphase1T;
                            currentState = States.Bauphase1O;
                        }
                        else
                        {
                            prewState = States.Bauphase2T;
                            currentState = States.Bauphase2O;
                        }
                    }
                    break;

                #endregion

                #region Camto2
                //Kamera wird an die Rechte Positon bewegt
                case States.Camto2:
                    aktuallisiereZeit(gameTime);
                    detecting = false;               //Kinect deaktiviert
                    weiterSym.Visible = false;

                    //Variable wird für nächste Schussphasen zurückgesetzt
                    firedWaffen = 0; 

                    //Kamera wird bewegt
                    cameraMovement.move(zeit, 3000, PosX1, level.getSpieler2Pos());

                #region Übergangsbedingungen
                    //Wenn die Spielerposition 2 erreicht wurde startet die Bauphase/Schussphase
                    if (Scene.Camera.Position.X == level.getSpieler2Pos())
                    {
                        //setzt die Variable PosX1 auf die Position bevor er in den nächsten State wechselt 
                        PosX1 = Scene.Camera.Position.X;
                        Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                        aktuallisiereZeit(gameTime);

                        //Wenn wir aus der Bauphase1 kommen -> Bauphase 2 (ohne Geld, aber mehr Geld als Sp1 Schussphase2)
                        if (prewState == States.Bauphase1O)
                        {
                            //Spieler2 hat genug Geld zum Bauen
                            if (spieler2.getMoney() >= level.getMinMoney())
                            {
                                prewState = States.Camto2;
                                currentState = States.Bauphase2O;
                            }
                            //Spieler zwei hat nicht genug Geld aber mehr als Spieler1 -> Schussphase 2
                            else if (spieler2.getMoney() > spieler1.getMoney())
                            {
                                prewState = States.Camto2;
                                currentState = States.Schussphase2;
                            }
                        }
                        //Wenn wir aus der Schussphase1 kommen, muss Schussphase 2 starten 
                        else if (prewState == States.Schussphase1)
                        {
                            prewState = States.Camto2;
                            currentState = States.Schussphase2;
                        }

                    }
                #endregion

                    break;

                #endregion

                #region Schussphasen
                //Schussphasen
                case States.Schussphase2:
                case States.Schussphase1:

                    
                    aktuallisiereZeit(gameTime);
                    detecting = true;               //Kinect aktiv
                    weiterSym.Visible = false;
                    int xR;

                    if (currentState == States.Schussphase1)
                    {
                        gamer = spieler1;
                        xR = 1;
                    }
                    else
                    {
                        gamer = spieler2;
                        xR = -1;
                    }
                    #region Schussfunktion //shoot Funktion TODO: "auslagern"
                    if (gamer.getWaffen() != 0)
                    {   
                        aktuelleWaffe = Objektverwaltung.getWaffe(gamer, firedWaffen);
                        aktuelleWaffe.setWinkel(rightHand.Position.Y);//Setzt Winkel der Kanone in Waffen

                        if (klick==true)
                        {
                           float schusswinkel,x,y,velocity;
                           Vector3 spawnpoint = new Vector3 ( rightHand.Position.X+1,rightHand.Position.Y-1, rightHand.Position.Z); //Spawnposition nur Vorübergehend sollte am Objekt sein!
                           bullet = new SphereObject(new Vector3(aktuelleWaffe.getPosition().X, aktuelleWaffe.getPosition().Y,rightHand.Position.Z), 0.1f, 10, 10, 0.05f);
                           Vector3 shootdirection = new Vector3();
                           Scene.Add(bullet);
                            
                           schusswinkel = aktuelleWaffe.getWinkel();
                           x=(float)Math.Cos(schusswinkel);
                           y=(float)Math.Sin(schusswinkel);
                           shootdirection = new Vector3(x,y,0);
                           if (gamer == spieler1)
                           {
                               velocity = leftHand.Position.Y * 10f;
                               bullet.Physics.LinearVelocity = shootdirection * velocity;


                           }
                           else
                           {
                               velocity = leftHand.Position.Y * 10f;
                               shootdirection.X = shootdirection.X * (-1f);
                               bullet.Physics.LinearVelocity = shootdirection * velocity;
                           }


                           firedWaffen++;
                           bulletInAir = true;
                           
                           
                        }
        
                        
                        
                    }
                    
                    
                    if (bulletInAir)
                    {
                       
                        cameraMovement.chaseBullet(bullet.Position, cam.Position);
                        
                        bullet.Collided +=new EventHandler<CollisionArgs>(bulletCollidedHandler);

                        //Partikel Effekte FUNKTIONIERT NOCH NICHT
                        ParticleEffect effect = new ParticleEffect()
                        {
                            Emitters = new EmitterCollection()
                                {   
                                    new SphereEmitter
                                    {
                                        Name="Flame",
                                        Budget = 100,
                                        Term = 0.5f,
                                        ReleaseQuantity = 8,
                                        Enabled = true,
                                        ReleaseSpeed = new Range(5f,5f),
                                        ReleaseColour = new ColourRange
                                        {
                                            Red = new Range(0.9f,1f),
                                            Green = new Range(0.5f,0.5f),
                                            Blue = new Range(0f,0f),
                                        },
                                        ReleaseOpacity = new Range(1f,1f),
                                        ReleaseScale = new Range(2f,2f),
                                        ReleaseRotation = new RotationRange
                                        {
                                            Pitch = new Range(0f,0f),
                                            Yaw = new Range(0f,0f),
                                            Roll = new Range(-3.14f,3.14f),
                                        },
                                        ParticleTexture = Core.Content.Load<Texture2D>("Flames"),
                                        BlendMode = EmitterBlendMode.Add,
                                        Radius = 3f,
                                        Shell = true,
                                        Radiate = true,                        
                                        BillboardStyle = ProjectMercury.BillboardStyle.Spherical,
                                        Modifiers = new ModifierCollection
                                        {
                                            new OpacityInterpolator2
                                            {
                                                InitialOpacity = 0.5f,                                
                                                FinalOpacity = 0f,
                                            },
                                            new RotationModifier
                                            {
                                                RotationRate = new Vector3(0,0,1)
                                            }
                                        },
                                        Controllers = new ControllerPipeline
                                        {
                                            new CooldownController
                                            {
                                                CooldownPeriod = 0.02f,
                                            },
                                        }
                                    }
                                }
                        };

                        ParticleObject particle = new ParticleObject(bullet.Position, effect);
                        
                       


                    }
                    
                    #endregion

                    #region Übergangsbedingungen
                    //Wenn alle Waffen abgefeuert wurden...
                    if (firedWaffen == gamer.getWaffen())
                    {
                        //setzt die Variable PosX1 auf die Position bevor er in den nächsten State wechselt 
                        PosX1 = Scene.Camera.Position.X;
                        Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                        aktuallisiereZeit(gameTime);

                        //Wenn die Schussphase durch ist, beginnt die Bauphase
                        if (schussphasenDurch)
                        {
                            if (currentState == States.Schussphase1)
                            {
                                prewState = States.Schussphase1;
                                schussphasenDurch = false;
                                currentState = States.Bauphase1O;
                            }
                            else
                            {
                                prewState = States.Schussphase2;
                                schussphasenDurch = false;
                                currentState = States.Camto1;
                            }
                        }

                        //Sonst in die andere Schussphase wechseln
                        else
                        {
                            if (currentState == States.Schussphase1)
                            {
                                prewState = States.Schussphase1;
                                schussphasenDurch = true;           //nach der Schussphase2 ist die Schussphase beendet
                                currentState = States.Camto2;
                            }
                            else
                            {
                                prewState = States.Schussphase2;
                                schussphasenDurch = true;           //nach der Schussphase1 ist die Schussphase beendet
                                currentState = States.Camto1;
                            }
                        }
                    }

                    #endregion


                    break;

                #endregion

                #region End
                //Ende des Spiels
                case States.End:
                    //noch leer



                    //neues Spiel, alle vorherigen Objekte werden gelöscht
                    Scene.RemoveAllSceneObjects();  
                    break;

                #endregion

                
            }




            #region Objekt-/ Texturauswahl ein-/ausblenden
            if (currentState != States.Menu && currentState != States.Start && currentState != States.End)
            {
                if (currentState == States.Bauphase1O)
                {
                    if (showWaffe)
                    {
                        startObjects.einausblender(auswahlanzeige, objWafC, 11, zeit);
                    }
                    else
                    {
                        startObjects.einausblender(auswahlanzeige, objWafC, 1, zeit);
                    }
                }
                else if (currentState == States.Bauphase1T)
                {
                    showWaffe = false;
                    startObjects.einausblender(auswahlanzeige, objWafC, 12, zeit);
                }
                else if (currentState == States.Bauphase2O)
                {
                    if (showWaffe)
                    {
                        startObjects.einausblender(auswahlanzeige, objWafC, 21, zeit);
                    }
                    else
                    {
                        startObjects.einausblender(auswahlanzeige, objWafC, 2, zeit);
                    }
                }
                else if (currentState == States.Bauphase2T)
                {
                    showWaffe = false;
                    startObjects.einausblender(auswahlanzeige, objWafC, 22, zeit);
                }
                else
                {
                    startObjects.einausblender(auswahlanzeige, objWafC, 0, zeit);
                }
            }



            #endregion

            #region Kinect
            if (detecting)
            {
                if (Scene.Kinect.SkeletonDataReady)
                {
                    List<NOVA.Components.Kinect.Skeleton> skeletons = new List<NOVA.Components.Kinect.Skeleton>(Scene.Kinect.Skeletons);

                    //Aktives Skelett finden
                    foreach (NOVA.Components.Kinect.Skeleton skeleton in skeletons)
                    {
                        if (skeleton.TrackingState == SkeletonTrackingState.Tracked && skeleton.Joints.Count != 0)
                        {
                            //Box auf Hand, Klick auf Weiter
                           #region Detektion der rechten Hand

                            if (skeleton.Joints[JointType.HandRight].TrackingState == JointTrackingState.Tracked)
                            {
                                //Position der rechten Hand des Spielers in Bildschirmkoodinaten
                                Vector2 screenPos = skeleton.Joints[JointType.HandRight].ScreenPosition;
                                Vector2 normScreenPos = new Vector2(screenPos.X, screenPos.Y);
                                screenPos.X = screenPos.X * Scene.Game.Window.ClientBounds.Width;
                                screenPos.Y *= Scene.Game.Window.ClientBounds.Height;

                                //parallele Ebene zum Bildschirm erzeugen in der die Kugel transformiert wird
                                Plane plane2 = new Plane(Vector3.Forward, -4f);

                                //Weltkoordinatenpunk finden
                                Vector3 worldPos2 = Helpers.Unproject(screenPos, plane2);

                                #region Box auf Hand
                                //Position der Kugel setzen
                                rightHand.Position = worldPos2;
                                #endregion

                                #region getObj
                                if (normScreenPos.X >= 0.2f && normScreenPos.X <= 0.8f && normScreenPos.Y <= 0.1f)
                                {
                                    getObj = true;
                                }
                                else {getObj = false; }
                                #endregion

                                #region WEITER klick
                                //Wenn sich die rechte Hand in der oberen, rechten Ecke befindet & KLICK -> Klick auf WEITER
                                if (normScreenPos.X >= 0.9f && normScreenPos.Y >= 0.9f)
                                {
                                    //setzt die Variable PosX1 auf die Position bevor er in den nächsten State wechselt 
                                    PosX1 = Scene.Camera.Position.X;
                                    Zeit1 = gameTime.TotalGameTime.Milliseconds + gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Minutes * 60 * 1000; //Zeit zwischenspeichern
                                    aktuallisiereZeit(gameTime);

                                    if (currentState == States.Bauphase1O)
                                    {
                                        prewState = States.Bauphase1O;

                                        //wenn Spieler2 über genügend Geld zum bauen verfügt, Bauphase Spieler 2
                                        //Wenn Spieler2 mehr Geld besitzt fängt er die Schussphase2 an
                                        if (spieler2.getMoney() >= level.getMinMoney() || spieler2.getMoney() > spieler1.getMoney())
                                        {
                                            currentState = States.Camto2;
                                        }
                                        //wenn Spieler2 nicht über genügend Geld zum bauen verfügt, und Spieler1 mehr Geld hat beginnt Schussphase1
                                        else
                                        {
                                            currentState = States.Schussphase1;
                                        }

                                    }
                                    else if (currentState == States.Bauphase2O)
                                    {
                                        prewState = States.Bauphase2O;

                                        //Wenn Spieler2 mehr Geld besitzt fängt er die Schussphase2 an
                                        if (spieler2.getMoney() > spieler1.getMoney())
                                        {
                                            currentState = States.Schussphase2;
                                        }
                                        //sonst Spieler 1
                                        else
                                        {
                                            currentState = States.Camto1;
                                        }

                                    }
                                    else
                                    {
                                        return;
                                    }
                                }
                                #endregion

                                

                            }
                            #endregion

                            //Box auf Hand, Auswahl Textur/ Objekt
                            #region Detektion der linken Hand
                            if (skeleton.Joints[JointType.HandLeft].TrackingState == JointTrackingState.Tracked)
                            {
                                //Position der linken Hand des Spielers in Bildschirmkoodinaten
                                screenPos = skeleton.Joints[JointType.HandLeft].ScreenPosition;
                                Vector2 normScreenPos = new Vector2(screenPos.X, screenPos.Y);
                                screenPos.X = screenPos.X * Scene.Game.Window.ClientBounds.Width;
                                screenPos.Y *= Scene.Game.Window.ClientBounds.Height;

                                //parallele Ebene zum Bildschirm erzeugen in der die Kugel transformiert wird
                                Plane plane2 = new Plane(Vector3.Forward, -1f);

                                //Weltkoordinatenpunk finden
                                Vector3 worldPos2 = Helpers.Unproject(screenPos, plane2);

                                #region Box auf Hand
                                //Position der Kugel setzen
                                leftHand.Position = worldPos2;
                                #endregion

                                #region Auswahl Textur/ Objekt
                                auswahl = Auswahl.auswahl(normScreenPos);

                                #endregion
                            }
                           
                            #endregion

                            //Hintergrundsbild verschieben
                            #region Detektion des Kopfes
                            if (skeleton.Joints[JointType.Head].TrackingState == JointTrackingState.Tracked)
                            {
                                //Position des Kopfes des Spielers in Bildschirmkoodinaten
                                Vector2 screenPos = skeleton.Joints[JointType.Head].ScreenPosition;
                                Vector2 normScreenPos = new Vector2(screenPos.X / Scene.Game.Window.ClientBounds.Width, screenPos.Y / Scene.Game.Window.ClientBounds.Height);

                                //Hintergrund bewegen
                                startObjects.MoveBackground(normScreenPos.X - 0.5f, normScreenPos.Y - 0.5f);
                                


                            }
                            
                            #endregion

                        }
                    }

                }
            }
            else
            {
                
            }
            #endregion

            

            objState = currentState; //Am Ende jenden Updates wird der State angeglichen

            Objektverwaltung.refreshObj(spieler1,spieler2); //Entfernt Objekte ohne LP
         
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
      
        }
        public PlayerShip(Game game, Vector2 position)
        {
            Game = game;
            _soundBank = Game.Services.GetService<SoundBank[]>();
            _world = Game.Services.GetService<World>();
            krypton = Game.Services.GetService<KryptonEngine>();

            thrustLR = _soundBank[0].GetCue("thrust01");
            thrustLR.Play();
            thrustLR.Pause();

            thrustUD = _soundBank[0].GetCue("thrust01");
            thrustUD.Play();
            thrustUD.Pause();

            Position = position;
            _particleRenderer = Game.Services.GetService<SpriteBatchRenderer>();
            //_textures = Game.Services.GetService<Textures>();

            //Loadcontentstuff
            _shiptxture = Game.Content.Load<Texture2D>("player_ship");
            _turretTxture = Game.Content.Load<Texture2D>(".\\guns\\turret01");
            _centreVect = new Vector2(_shiptxture.Width / 2, _shiptxture.Height / 2);

            ProximityBox = new Rectangle(0, 0, _shiptxture.Width+Globals.PhysBuffer, _shiptxture.Height + Globals.PhysBuffer);

            //make ship fixture in for farseer
            box = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(_shiptxture.Width / 2), 7.0f);
            box.BodyType = BodyType.Dynamic;
            box.Restitution = 0.5f;
            box.Friction = 0.2f;
            box.FixedRotation = true;
            box.LinearDamping = 0.4f;
            box.Position = ConvertUnits.ToSimUnits(Position.X + _centreVect.X, Position.Y + _centreVect.Y);
            box.UserData = "player";

            //box.OnCollision += Collide;
            box.OnSeparation += Collide;

            //make light in krypton
            var mLightTexture = LightTextureBuilder.CreateConicLight(Game.GraphicsDevice, 256, 2.0f);
            light = CreateLights(mLightTexture,400);
            var mLightTexture2 = LightTextureBuilder.CreatePointLight(Game.GraphicsDevice, 64);
            light2 = CreateLights(mLightTexture2,200);

            //set up thruster particle
            _thrustparticle = Game.Content.Load<ParticleEffect>(".\\mercury\\thruster");
            _thrustparticle.LoadContent(Game.Content);
            _thrusterEmitter = (ConeEmitter)_thrustparticle[0];
            //_thrusterEmitter.Initialise();
            _thrusterEmitter.ParticleTexture = Game.Content.Load<Texture2D>(".\\mercury\\Particle004");
            _thrustparticle.Initialise();
            _particleRenderer.LoadContent(Game.Content);

            //_centerVect = new Vector2(_shiptxture.Width / 2,_shiptxture.Width / 2);
            currentWeapon = new Gun(Game, true, BulletsStats.Plasma01);
        }
 public void LoadFromFile(Game game, string path)
 {
     effect = game.Content.Load<ParticleEffect>(path);
     effect.LoadContent(game.Content);
     effect.Initialise();
 }