Beispiel #1
0
        public NetLevelState(IStateManager manager, DroughtGame game, Level aLevel, bool isHost)
            : base(manager, game)
        {
            soundManager = game.getSoundManager();
            networkManager = game.getNetworkManager();
            hosting = isHost;

            input = DeviceInput.getInput();

            sun = new Sun(new Vector3(0, -200, 200));

            levelInfo = new LevelInfo();
            levelInfo.initialise(aLevel);

            List<List<Vector3>> waterList = Water.findWater(levelInfo);
            waters = new Water[waterList.Count];

            for (int i = 0; i < waters.Length; i++)
                waters[i] = new Water(waterList[i], levelInfo, sun, getGraphics());

            aStar = new AStar(levelInfo);

            rain = new PlaneParticleEmitter(512, 256, new Vector3(256, 128, 200), new Vector3(0, 0, 0), new Vector3(3f, 0, -19f), Color.LightBlue.ToVector4(), 100000, 9);

            camera = new Camera(this, levelInfo, false);

            terrain = new Terrain(getGraphics(), getContentManager(), levelInfo, camera);

            soundManager.setListener(camera);

            modelLoader = new ModelLoader(getContentManager(), getGraphics());

            skybox = new Skybox(camera, sun, modelLoader.getModel3D(modelType.Skybox));

            lineTool = new LineTool(getGraphics());

            loadContent();

            initializeEntities();

            foreach (MovableEntity entity in localEntities)
                soundManager.playSound(SoundHandle.Truck, entity);
        }
Beispiel #2
0
        private void initialise()
        {
            input = DeviceInput.getInput();

            //initialise the title state
            titleState = new TitleState(getStateManager(), getGame(), Level.Title);
            titleState.getCamera().setEyeVector(new Vector3(380,410,370));
            titleState.getCamera().setRotation(-3.75f/3.5f, -3.15f);
            titleState.getCamera().update();

            canNext = true;
            canPrev = true;
            canPress = true;

            float scale = 0.35f * (screenHeight / 600.0f);
            float mainX = 25.0f * (screenWidth / 800.0f);
            float mainY = 300.0f * (screenHeight / 600.0f);
            float mainSpacing = 70.0f * (screenHeight / 600.0f);
            //Console.WriteLine("scale = " + scale + ", x = " + mainX + ", y = " + mainY + ", yspacing = " + mainSpacing);

            mainMenu = new Menu(this);
            mainMenu.activate();

            MenuItem localGame = new MenuItem(MenuFunctions.LOCALLIST, "Local Game", defaultFont);
            localGame.setScale(scale);
            localGame.position = new Vector2(mainX, mainY);
            mainMenu.addSelectableItem(localGame);
            mainY += mainSpacing;

            MenuItem hostGame = new MenuItem(MenuFunctions.HOSTLIST, "Host Game", defaultFont);
            hostGame.setScale(scale);
            hostGame.position = new Vector2(mainX, mainY);
            mainMenu.addSelectableItem(hostGame);
            mainY += mainSpacing;

            MenuItem joinGame = new MenuItem(MenuFunctions.JOINLIST, "Join Game", defaultFont);
            joinGame.setScale(scale);
            joinGame.position = new Vector2(mainX, mainY);
            mainMenu.addSelectableItem(joinGame);
            mainY += mainSpacing;

            MenuItem quit = new MenuItem(MenuFunctions.QUIT, "Quit", defaultFont);
            quit.setScale(scale);
            quit.position = new Vector2(mainX, mainY);
            mainMenu.addSelectableItem(quit);
            mainY += mainSpacing;

            localMenu = new Menu(this);

            hostMenu = new Menu(this);

            joinMenu = new Menu(this);

            float quitX = 500.0f * (screenWidth / 800.0f);
            float quitY = 300.0f * (screenHeight / 600.0f);
            quitMenu = new Menu(this);

            MenuItem quitInfo = new MenuItem(MenuFunctions.NONE, "Are you sure?", defaultFont);
            quitInfo.setScale(scale);
            quitInfo.position = new Vector2(quitX, quitY);
            quitInfo.setDefaultColor(Color.Blue);
            quitMenu.addNonSelectableItem(quitInfo);
            quitY += mainSpacing;

            MenuItem quitYes = new MenuItem(MenuFunctions.QUIT_YES, "Yes", defaultFont);
            quitYes.setScale(scale);
            quitYes.position = new Vector2(quitX, quitY);
            quitMenu.addSelectableItem(quitYes);
            quitY += mainSpacing;

            MenuItem quitNo = new MenuItem(MenuFunctions.QUIT_NO, "No", defaultFont);
            quitNo.setScale(scale);
            quitNo.position = new Vector2(quitX, quitY);
            quitMenu.addSelectableItem(quitNo);

            currMenu = mainMenu;
        }
Beispiel #3
0
        public LevelState(IStateManager manager, DroughtGame game, Level aLevel)
            : base(manager, game)
        {
            /* TEMP */
            explosionParticles = new ExplosionParticleSystem(getContentManager(), getGraphics());
            explosionSmokeParticles = new ExplosionSmokeParticleSystem(getContentManager(), getGraphics());
            projectileTrailParticles = new ProjectileTrailParticleSystem(getContentManager(), getGraphics());
            smokePlumeParticles = new SmokePlumeParticleSystem(getContentManager(), getGraphics());
            fireParticles = new FireParticleSystem(getContentManager(), getGraphics());
            projectileManager = new ProjectileManager(explosionParticles, explosionSmokeParticles, projectileTrailParticles);

            soundManager = game.getSoundManager();

            input = DeviceInput.getInput();

            sun = new Sun(new Vector3(0, -200, 200));

            levelInfo = new LevelInfo();
            levelInfo.initialise(aLevel);

            TextureMap textureMap = new TextureMap(aLevel);
            //List<List<Vector3>> waterList = Water.findWater(levelInfo);
            List<List<Vector3>> waterListPleh = textureMap.findWater();
            //waters = new Water[waterList.Count];
            waters = new Water[waterListPleh.Count];

            Water[,] waterLocationTable = new Water[levelInfo.getWidth(), levelInfo.getHeight()];
            for (int i = 0; i < waters.Length; i++)
            {
                //waters[i] = new Water(waterList[i], levelInfo, getGraphics());
                waters[i] = new Water(waterListPleh[i], levelInfo, sun, getGraphics());

                for (int j = 0; j < waterListPleh[i].Count; j++)
                {
                    Vector3 p = waterListPleh[i][j];
                    waterLocationTable[(int)p.X, (int)p.Y] = waters[i];
                }
            }
            levelInfo.setWaterPools(waterLocationTable);

            camera = new Camera(this, levelInfo, false);

            rain = new PlaneParticleEmitter(512, 256, new Vector3(256, 128, 200), new Vector3(0, 0, 0), new Vector3(3f, 0, -19f), Color.LightBlue.ToVector4(), 10000, 9);

            terrain = new Terrain(getGraphics(), getContentManager(), levelInfo, camera);

            modelLoader = new ModelLoader(getContentManager(), getGraphics());

            skybox = new Skybox(camera, sun, modelLoader.getModel3D(modelType.Skybox));

            lineTool = new LineTool(getGraphics());

            aStar = new AStar(levelInfo);

            soundManager.setListener(camera);

            loadContent();

            initializeEntities();

            foreach (MovableEntity entity in entities)
                soundManager.playSound(SoundHandle.Truck, entity);
        }