Exemple #1
0
        public Bubble(Model model, Game game, Camera camera, OctTree octTree, Vector3 startPosition, Vector3 startDirection, Vector3 startUp, BasicCube[] worldMap, ScreenManager screenManager)
            : base(model, game)
        {
            this.octTree = octTree;
            //  shadow = game.Content.Load<Effect>(@"Shader/Shadow");
            movementHandler = new MovementAndInputHandler(game, this);
            collisionHandler = new CollisionHandler(game, this, screenManager, worldMap);
            effect = ((Spectrum)game).effect;
            texture = screenManager.texManager.getBubbleTexture();
            this.camera = camera;
            this.currentPosition = startPosition;
            this.game = game;
            this.bubble = model;
            this.startPosition = startPosition;
            this.currentPosition = startPosition;
            movementHandler.setStartValues(startPosition, Vector3.Backward, Vector3.Up, Quaternion.Identity, SpectrumEnums.Orientation.posY);

            this.soundManager = ((Spectrum)game).soundManager;

            this.screenManager = screenManager;
            this.screenManager.setPlayer(this);
        }
 //############ General ############//
 public MovementAndInputHandler(Game game, Bubble player)
 {
     this.player = player;
     currentKeyState = Keyboard.GetState();
     this.soundManager = ((Spectrum)game).soundManager;
     this.startDirection = Vector3.Backward;
     startDirection.Normalize();
     currentDirection = startDirection;
     currentUp = Vector3.Up;
     currentOrientation = SpectrumEnums.Orientation.posY;
     jumping = false;
 }
Exemple #3
0
        protected override void Initialize()
        {
            currentGameState = SpectrumEnums.GameState.Start;
            effect = Content.Load<Effect>(@"Shader/Shader");
            grayEffect = Content.Load<Effect>(@"Shader/Grayscale");
            loadFromSaveFile();

            gameAnalytics = new GameAnalytics();
            this.texManager = new TextureManager(this);
            Components.Add(texManager);
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
            camera = new Camera(this, new Vector3(0, 10, 5), new Vector3(0, 8, 3), new Vector3(0, 5, 0));
            Components.Add(camera);
            modelManager = new ModelManager(this, screenManager);
            Components.Add(modelManager);
            screenManager.setModelManager(modelManager);
            soundManager = new SoundManager(this);
            Components.Add(soundManager);
            // set render target in order to be able to apply post processing effets
            renderTarget = new RenderTarget2D(graphics.GraphicsDevice,
                GraphicsDevice.PresentationParameters.BackBufferWidth,
                GraphicsDevice.PresentationParameters.BackBufferHeight,
                true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
            this.IsMouseVisible = false;
            base.Initialize();
        }