예제 #1
0
파일: Game1.cs 프로젝트: rroveri/triolozzi
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            GameServices.AddService<GraphicsDeviceManager>(graphics);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferHeight = (int)(1080);
            graphics.PreferredBackBufferWidth = (int)(1920);

            graphics.PreferredBackBufferHeight = (int)(720);
            graphics.PreferredBackBufferWidth = (int)(1280);

            graphics.IsFullScreen = false;

            Window.Title = "The Drunken Dream Maker (With a Cold)";

            ScreenManager = new ScreenManager(this);
            ScreenManager.initParameters();
            Components.Add(ScreenManager);

            SoundManager = new SoundManager(this);
            Components.Add(SoundManager);

            particleComponent = new ParticleComponent(this);
            Components.Add(particleComponent);

               // FrameRateCounter myFrameCounter = new FrameRateCounter(this, new Vector2(25, 25), Color.White, Color.Black);
               // Components.Add(myFrameCounter);
        }
예제 #2
0
        public Ennemi(Animate textureAnime, Vector2 position, Hero hero, Map map)
        {
            this.textureAnime = Ressources.GetPerso(Perso.Choisi).ennemiTextureAnime;
            this.texture = Ressources.GetPerso(Perso.Choisi).ennemiTexture;
            this.personnageAnime = Ressources.GetPerso(Perso.Choisi).ennemiAnime;
            this.positionGlobale = position;
            this.positionInitiale = position;
            this.vitesse = hero.vitesse;
            this.vitesseInitiale = hero.vitesse;
            this.container = new Rectangle((int)position.X, (int)position.Y, (int)(textureAnime.Texture.Width / textureAnime.Columns), textureAnime.Texture.Height);
            this.type = TypePerso.Ennemi;
            this.poids = new Vector2(0, hero.poids.Y);
            this.force = Vector2.Zero;
            this.reaction = Vector2.Zero;
            this.map = map;
            this.currentObjet = new Objet();
            this.hero = hero;

            ACDC = new Rectangle(0, 0, texture.Width, texture.Height);

            animate = true;
            dead = false;

            font = Ressources.GetPerso(Perso.Choisi).font;

            #region moteur à particules
            particleComponent = new ParticleComponent(Ressources.Game);
            Ressources.Game.Components.Add(particleComponent);
            Emitter fireEmitter = new Emitter();
            fireEmitter.Active = false;
            fireEmitter.TextureList.Add(Ressources.GetPerso(Perso.Choisi).obstacle);
            fireEmitter.RandomEmissionInterval = new RandomMinMax(50);
            fireEmitter.ParticleLifeTime = 9000;
            fireEmitter.ParticleDirection = new RandomMinMax(270, 300);
            fireEmitter.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            fireEmitter.ParticleRotation = new RandomMinMax(0, 180);
            fireEmitter.RotationSpeed = new RandomMinMax(0.04f);
            fireEmitter.ParticleFader = new ParticleFader(false, true, 30);
            fireEmitter.ParticleScaler = new ParticleScaler(0.2f, 0.18f, 0, 100);
            fireEmitter.Position = new Vector2(400, 650);
            //******piece*********
            Emitter desinté_piece = new Emitter();
            desinté_piece.Active = false;
            desinté_piece.TextureList.Add(Ressources.GetPerso(Perso.Choisi).piece);
            desinté_piece.RandomEmissionInterval = new RandomMinMax(50);
            desinté_piece.ParticleLifeTime = 9000;
            desinté_piece.ParticleDirection = new RandomMinMax(270, 300);
            desinté_piece.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            desinté_piece.ParticleRotation = new RandomMinMax(0, 180);
            desinté_piece.RotationSpeed = new RandomMinMax(0.04f);
            desinté_piece.ParticleFader = new ParticleFader(false, true, 30);
            desinté_piece.ParticleScaler = new ParticleScaler(1.2f, 0.18f, 0, 100);
            desinté_piece.Position = new Vector2(400, 650);
            particleComponent.particleEmitterList.Add(fireEmitter);
            particleComponent.particleEmitterList.Add(desinté_piece);
            #endregion
        }
예제 #3
0
파일: Game1.cs 프로젝트: Nyjun/SteelEra
        // MUSIQUE + BRUITAGES Xact method
        /*public AudioEngine audioEngine;
        public WaveBank waveBank;
        public SoundBank soundBank;
        public Cue currentSong;

        // Music volume.
           // float musicVolume = 1.0f;*/
        /*SoundEffect jump;
        SoundEffectInstance jumpInst;
        SoundEffect landing;
        SoundEffectInstance landingInst;
        SoundEffect attack1;
        SoundEffectInstance attack1Inst;*/
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.IsMouseVisible = false;

            graphics.PreferredBackBufferHeight = 765;
            graphics.PreferredBackBufferWidth = 1366;
            //Changes the settings that you just applied
            graphics.ApplyChanges();

            //FrameRateCounter FrameRateCounter = new FrameRateCounter(this, "Fonts\\Default");
            particleComponent = new ParticleComponent(this);

            //this.Components.Add(FrameRateCounter);
            this.Components.Add(particleComponent);
        }
예제 #4
0
        public Hero(Animate textureAnime, Vector2 position, Vector2 vitesse, float poids, Map map)
        {
            this.texture = Ressources.GetPerso(Perso.Choisi).heroTexture;
            this.textureAnime = Ressources.GetPerso(Perso.Choisi).heroTextureAnime;
            this.textureDown = Ressources.GetPerso(Perso.Choisi).heroTextureDown;
            this.personnageAnime = Ressources.GetPerso(Perso.Choisi).heroAnime;
            this.positionGlobale = position;
            this.positionInitiale = position;
            this.vitesse = vitesse;
            this.vitesseInitiale = vitesse;
            this.type = TypePerso.Hero;
            this.poids = new Vector2(0, poids);
            this.force = Vector2.Zero;
            this.reaction = Vector2.Zero;
            this.map = map;
            containerDown = new Rectangle((int)positionGlobale.X, (int)positionGlobale.Y + texture.Height - textureDown.Height, textureDown.Width, textureDown.Height);
            containerUp = new Rectangle((int)positionGlobale.X, (int)positionGlobale.Y, texture.Width, texture.Height);
            this.container = containerUp;
            down = false;
            acdcTexture = Ressources.Content.Load<Texture2D>("ACDC");
            containerACDC = new Rectangle((int)positionGlobale.X - acdcTexture.Width, (int)positionGlobale.Y, acdcTexture.Width, acdcTexture.Height);
            acdc = false;
            currentObjet = new Objet();
            animate = true;
            random = new Random();
            bonusVitesse = false;
            dead = false;
            win = false;
            superman = Ressources.Content.Load<Texture2D>("superman");
            font = Ressources.GetPerso(Perso.Choisi).font;
            //moteur à particule pour la bombe
            #region Moteur a particules
            Emitter.statut = true;
            particleComponent = new ParticleComponent(Ressources.Game);
            Ressources.Game.Components.Add(particleComponent);
            bombe.Active = false;
            bombe.TextureList.Add(Ressources.Content.Load<Texture2D>("fire"));
            bombe.RandomEmissionInterval = new RandomMinMax(2.0d);
            bombe.ParticleLifeTime = 2000;
            bombe.ParticleDirection = new RandomMinMax(0, 359);
            bombe.ParticleSpeed = new RandomMinMax(0.1f, 1.0f);
            bombe.ParticleRotation = new RandomMinMax(0, 100);
            bombe.RotationSpeed = new RandomMinMax(0.015f);
            bombe.ParticleFader = new ParticleFader(false, true, 1350);
            bombe.ParticleScaler = new ParticleScaler(false, 0.3f);
            bombe.Position = new Vector2(400, 400);
            particleComponent.particleEmitterList.Add(bombe);
            //***************fumée**************************
            smokeEmitter.Active = false;
            smokeEmitter.TextureList.Add(Ressources.Content.Load<Texture2D>("smoke"));
            smokeEmitter.RandomEmissionInterval = new RandomMinMax(100);
            smokeEmitter.ParticleLifeTime = 9000;
            smokeEmitter.ParticleDirection = new RandomMinMax(-5, 5);
            smokeEmitter.ParticleSpeed = new RandomMinMax(0.6f);
            smokeEmitter.ParticleRotation = new RandomMinMax(0);
            smokeEmitter.RotationSpeed = new RandomMinMax(-0.008f, 0.008f);
            smokeEmitter.ParticleFader = new ParticleFader(true, true);
            smokeEmitter.ParticleScaler = new ParticleScaler(0.15f, 0.7f, 400, smokeEmitter.ParticleLifeTime);
            smokeEmitter.Position = new Vector2(0, 0);
            particleComponent.particleEmitterList.Add(smokeEmitter);
            //*********************************************
            //*******************************************

            // **** neige*****************
            testEmitter2.Active = false;
            testEmitter2.TextureList.Add(Ressources.Content.Load<Texture2D>("raindrop"));
            testEmitter2.RandomEmissionInterval = new RandomMinMax(9.0d);
            testEmitter2.ParticleLifeTime = 1000;
            testEmitter2.ParticleDirection = new RandomMinMax(170);
            testEmitter2.ParticleSpeed = new RandomMinMax(5.0f);
            testEmitter2.ParticleRotation = new RandomMinMax(0);
            testEmitter2.RotationSpeed = new RandomMinMax(0f);
            testEmitter2.ParticleFader = new ParticleFader(false, true, 800);
            testEmitter2.ParticleScaler = new ParticleScaler(false, 1.0f);
            testEmitter2.Opacity = 255;
            particleComponent.particleEmitterList.Add(testEmitter2);
            //**************************
            #endregion
        }
예제 #5
0
        /// <summary>
        /// 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>
        public GameScreen()
        {
            firstTime = true;

            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            RankScreen = new RankingScreen();
            RankScreen.Accepted += RankScreenAccepted;
            PauseScreen = new PauseMenuScreen();

            polygonsList = new List<PolygonPhysicsObject>();
            Cars = new List<Car>();
            playerIndexes = new List<PlayerIndex>();
            playerIndexes.Add(PlayerIndex.One); playerIndexes.Add(PlayerIndex.Two);
            playerIndexes.Add(PlayerIndex.Three); playerIndexes.Add(PlayerIndex.Four);
            Random = new Random(DateTime.Now.Millisecond);

            PlayersCount = 4;
            startingPos = new Vertices();

            readyToStart = false;
            aabbVerts = new Vector2[4];
            activeBodiesCount = 0;
            startingPosAabbVerts = new Vector2[4];

            particleComponent = GameServices.GetService<ParticleComponent>();

            collisionsQuotes = collisionsQuotesNormal;

            dummyTexture = new Texture2D(GameServices.GetService<GraphicsDevice>(), 1, 1);
            byte whiteAlpha = 50;
            Color dummyTextureColor = new Color(whiteAlpha, whiteAlpha, whiteAlpha);
            dummyTexture.SetData(new Color[] { dummyTextureColor });

            mySneezesManager = new SneezesManager();

            obstaclesLoop = 0;
        }
예제 #6
0
        public RandomTrack()
        {
            // Define the worls in which the track is going to be drawn
            world = GameServices.GetService<World>();
            controlPoints=new Vertices();
            curvePointsInternal = new Vertices();
            curvePointsExternal = new Vertices();
            curvePointsMiddle = new Vertices();
            internalCorrispondances= new List<int>();
            dummyTexture = new Texture2D(GameServices.GetService<GraphicsDevice>(), 1, 1);
            dummyTexture.SetData(new Color[] { Color.White });
            random = new Random(DateTime.Now.Millisecond);
            normals = new List<Vector2>();
            normalsInternal = new List<Vector2>();
            ContentManager Content = GameServices.GetService<ContentManager>();
            bgTexture = Content.Load<Texture2D>("Images/bgNew");
            bgTextureEasterEgg = Content.Load<Texture2D>("Images/bgNew2");
            currentTexture = bgTexture;
            currentTextureIndex = 0;

            rainbowTex = Content.Load<Texture2D>("Images/rainbow_texture");

            texturesArray = new List<Texture2D>();
            texturesArray.Add(bgTexture);
            texturesArray.Add(Content.Load<Texture2D>("Images/ColinComm2"));
            texturesArray.Add(Content.Load<Texture2D>("Images/asd"));
            texturesArray.Add(Content.Load<Texture2D>("Images/BlackNight_o_o"));
            texturesArray.Add(Content.Load<Texture2D>("Images/cina"));
            texturesArray.Add(Content.Load<Texture2D>("Images/q"));
            texturesArray.Add(bgTextureEasterEgg);

            postItDreamsList = new List<PostItDream>();
            listNightmaresTextures = new List<Texture2D>();
            listWishesTextures = new List<Texture2D>();

            listWishesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Wishes/Ali_Resized"));
            listWishesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Wishes/Pony_Resized"));
            listWishesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Wishes/Cupcake_Resized"));
            listNightmaresTextures.Add(Content.Load<Texture2D>("Images/Dreams/Nightmares/Diavolo_Resized"));
            listNightmaresTextures.Add(Content.Load<Texture2D>("Images/Dreams/Nightmares/Fantasma_Resized"));
            listNightmaresTextures.Add(Content.Load<Texture2D>("Images/Dreams/Nightmares/Frankenstein_Resized"));

            postItQuotesList=new List<PostItQuote>();
            listQuotesTextures = new List<Texture2D>();
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/buyBeers"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/buyMilk"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/callLuigi"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/mamaBDay"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/marketingMeeting"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/todolist"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/aameeting"));
            listQuotesTextures.Add(Content.Load<Texture2D>("Images/Dreams/Quotes/feedTheCat"));

            postItSize = new Vector2(500f,500f);
            dreamsMiddlePoints = new List<int>();

            internalNormalsCoefficients = new List<float>();
            externalNormalsCoefficients = new List<float>();

            _particleComponent = GameServices.GetService<ParticleComponent>();

            wishSound = GameServices.GetService<ContentManager>().Load<SoundEffect>("Sounds/wishSound");
            nightmareSound = GameServices.GetService<ContentManager>().Load<SoundEffect>("Sounds/nightmareSound");
        }