Ejemplo n.º 1
0
 public TutorialWidget(SpriteBatch spriteBatch, Soul game, string id, string filename, Vector2 positionOffset)
 {
     this.spriteBatch = spriteBatch;
     this.game = game;
     this.frame = new Sprite(spriteBatch, game, filename);
     this.frameOffset = frame.Dimension * 0.5f;
     this.positionOffset = positionOffset;
     this.glow = new GlowFX(game, 0.01f, 0.4f, 0.9f);
     this.id = id;
 }
Ejemplo n.º 2
0
 public BrainMapMarker(SpriteBatch spriteBatch, Soul game, InputManager controls, Vector2 position, string filename, string id, bool cleansed)
     : base(id)
 {
     this.cleansed = cleansed;
     marker = new Sprite(spriteBatch, game, filename);
     this.controls = controls;
     this.position = position;
     offset = new Vector2((float)marker.X * 0.5f, (float)marker.Y * 0.5f);
     status = new Sprite(spriteBatch, game, Constants.BRAIN_MAP_STATUS);
     if (cleansed == true)
     {
         statusSecond = new Sprite(spriteBatch, game, Constants.BRAIN_MAP_CLEANSED);
         glowFX = new GlowFX(game, Constants.FLASH_EFFECT_GREEN_FILENAME, 0.01f, .4f, .8f);
     }
     else
     {
         statusSecond = new Sprite(spriteBatch, game, Constants.BRAIN_MAP_INFECTED);
         glowFX = new GlowFX(game, Constants.FLASH_EFFECT_RED_FILENAME, 0.01f, .4f, .8f);
     }
 }
Ejemplo n.º 3
0
        public override void initialize(string data)
        {
            this.pressStartOnce = false;
            glowList = new List<GlowParticle>();
            nextState = "";
            bg = new Sprite(spriteBatch, game, Constants.MENU_COMBINED_BG_COLORMAP);
            bg_normal = new Sprite(spriteBatch, game, Constants.MENU_COMBINED_BG_NORMALMAP);
            bg_front = new Sprite(spriteBatch, game, Constants.MENU_FRONT_BG_COLORMAP);
            bg_front_normal = new Sprite(spriteBatch, game, Constants.MENU_FRONT_BG_NORMALMAP);
            bg_spikes = new Sprite(spriteBatch, game, Constants.MENU_SPIKES_BG_COLORMAP);
            fog = new Sprite(spriteBatch, game, "Backgrounds\\background__0002s_0001_Layer-8");
            logo = new Sprite(spriteBatch, game, "GUI\\logo_SOUL");
            fade = new FadeInOut(spriteBatch, game);
            audio.playMusic("menu_music");
            glowFX = new GlowFX(game);
            menuStateManager = new MenuStateManager(spriteBatch, game, graphics, displayModes, controls, audio);
            menuStateManager.Initialize();
            spriteFont = game.Content.Load<SpriteFont>(Constants.GUI_FONT);
            askToQuit = new MenuManager(controls, "askToQuit");
            ImageButton button = new ImageButton(spriteBatch, game, controls, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f - 300, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_YES, "quit_yes");
            Label label = new Label(spriteBatch, game, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f), "quit_text", "Are you sure you want to quit?", false);
            button.onClick += new ImageButton.ButtonEventHandler(QuitConfirm);
            askToQuit.AddButton(button, label);
            button = new ImageButton(spriteBatch, game, controls, new Vector2(Constants.RESOLUTION_VIRTUAL_WIDTH * 0.5f + 300, Constants.RESOLUTION_VIRTUAL_HEIGHT * 0.5f + 250.0f), Constants.GUI_NO, "quit_no");
            button.onClick += new ImageButton.ButtonEventHandler(QuitConfirm);
            askToQuit.AddButton(button);
            askToQuit.initialize();

            #region InitializeLighting
            PresentationParameters pp = game.GraphicsDevice.PresentationParameters;
            //int width = Constants.RESOLUTION_VIRTUAL_WIDTH;
            //int height = Constants.RESOLUTION_VIRTUAL_HEIGHT;
            int width = pp.BackBufferWidth;
            int height = pp.BackBufferHeight;
            SurfaceFormat format = pp.BackBufferFormat;
            Vertices = new VertexPositionColorTexture[4];
            Vertices[0] = new VertexPositionColorTexture(new Vector3(-1, 1, 0), Color.White, new Vector2(0, 0));
            Vertices[1] = new VertexPositionColorTexture(new Vector3(1, 1, 0), Color.White, new Vector2(1, 0));
            Vertices[2] = new VertexPositionColorTexture(new Vector3(-1, -1, 0), Color.White, new Vector2(0, 1));
            Vertices[3] = new VertexPositionColorTexture(new Vector3(1, -1, 0), Color.White, new Vector2(1, 1));
            VertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionColorTexture), Vertices.Length, BufferUsage.None);
            VertexBuffer.SetData(Vertices);

            colorMap = new RenderTarget2D(game.GraphicsDevice, width, height);
            normalMap = new RenderTarget2D(game.GraphicsDevice, width, height);
            shadowMap = new RenderTarget2D(game.GraphicsDevice, width, height, false, format, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents);

            lightEffect = game.Content.Load<Effect>("Shaders\\MultiTarget");
            lightCombinedEffect = game.Content.Load<Effect>("Shaders\\DeferredCombined");

            lightEffectTechniquePointLight = lightEffect.Techniques["DeferredPointLight"];
            lightEffectParameterConeDirection = lightEffect.Parameters["coneDirection"];
            lightEffectParameterLightColor = lightEffect.Parameters["lightColor"];
            lightEffectParameterLightDecay = lightEffect.Parameters["lightDecay"];
            lightEffectParameterNormalMap = lightEffect.Parameters["NormalMap"];
            lightEffectParameterPosition = lightEffect.Parameters["lightPosition"];
            lightEffectParameterScreenHeight = lightEffect.Parameters["screenHeight"];
            lightEffectParameterScreenWidth = lightEffect.Parameters["screenWidth"];
            lightEffectParameterStrenght = lightEffect.Parameters["lightStrength"];

            lightCombinedEffectTechnique = lightCombinedEffect.Techniques["DeferredCombined2"];
            lightCombinedEffectParamAmbient = lightCombinedEffect.Parameters["ambient"];
            lightCombinedEffectParamLightAmbient = lightCombinedEffect.Parameters["lightAmbient"];
            lightCombinedEffectParamAmbientColor = lightCombinedEffect.Parameters["ambientColor"];
            lightCombinedEffectParamColorMap = lightCombinedEffect.Parameters["ColorMap"];
            lightCombinedEffectParamShadowMap = lightCombinedEffect.Parameters["ShadingMap"];
            lightCombinedEffectParamNormalMap = lightCombinedEffect.Parameters["NormalMap"];
            #endregion InitializeLighting

            /*PointLight light = new PointLight()
            {
                Color = new Vector4(1f, 1f, 1f, 1f),
                Power = 8f,
                LightDecay = 300,
                Position = new Vector3(200f, 400f, 50f),
                IsEnabled = true
            };

            lights.Add(light);*/
            random = new Random();
            fade.FadeIn();
        }
Ejemplo n.º 4
0
        public Player(SpriteBatch spriteBatch, Soul game, AudioManager audioManager, string alias, EntityManager entityManager, InputManager controls)
            : base(spriteBatch, game, Constants.PLAYER_FILENAME, new Vector2(Constants.PLAYER_WIDTH, Constants.PLAYER_HEIGHT), alias, EntityType.PLAYER)
        {
            audio = audioManager;
            this.entityManager = entityManager;
            this.controls = controls;
            weapon = new PlayerWeapon(spriteBatch, game, (int)dimension.Y);
            weapon.Damage = damage;
            acceleration = new Vector2 (Constants.PLAYER_ACCELERATION);
            animationState = (int)PlayerAnimationState.IDLE;
            hitFx = new HitFX(game);
            warningGlow = new GlowFX(game, Constants.FLASH_EFFECT_RED_FILENAME, 0.05f, 0.1f, 0.9f);
            this.animation.FrameRate = 30;
            this.maxDeathLightDecay = int.Parse(game.lighting.getValue("PlayerDeath", "MaxDecay"));
            this.maxDeathPower = float.Parse(game.lighting.getValue("PlayerDeath", "MaxPower"));
            this.deathDecayScaleUp = int.Parse(game.lighting.getValue("PlayerDeath", "DecayScaleUp"));
            this.deathDecayScaleDown = int.Parse(game.lighting.getValue("PlayerDeath", "DecayScaleDown"));
            this.deathPowerScaleUp = float.Parse(game.lighting.getValue("PlayerDeath", "PowerScaleUp"));
            this.deathPowerScaleDown = float.Parse(game.lighting.getValue("PlayerDeath", "PowerScaleDown"));
            this.secondExplosionLight = int.Parse(game.lighting.getValue("PlayerDeath", "SecondExplosionLightSize"));
            this.secondExplosionLightScalar = int.Parse(game.lighting.getValue("PlayerDeath", "SecondExplosionLightScalar"));
            this.secondExplosionPower = float.Parse(game.lighting.getValue("PlayerDeath", "SecondExplosionPower"));
            this.secondExplosionPwrScalar = float.Parse(game.lighting.getValue("PlayerDeath", "SecondExplosionPowerScalar"));
            this.fadeOutLight = int.Parse(game.lighting.getValue("PlayerDeath", "FadeOutLightScalar"));
            this.fadeOutPower = float.Parse(game.lighting.getValue("PlayerDeath", "FadeOutPowerScalar"));
            this.healthLightMaxRadius = int.Parse(game.lighting.getValue("PlayerHealthLight", "MaxRadius"));
            this.healthLightMinRadius = int.Parse(game.lighting.getValue("PlayerHealthLight", "MinRadius"));
            this.playerMaxSpeed = float.Parse(game.constants.getValue("PLAYER", "SPEED"));
            this.healthPowerup = int.Parse(game.constants.getValue("HEALTH_POWERUP", "HEALTH"));
            this.tutorial = bool.Parse(game.config.getValue("General", "Tutorial"));
            this.animation.playOnce = true;
            this.animation.FrameRate = 150;
            this.currentHealthRadi = healthLightMaxRadius;
            this.playerHealthLight = new PlayerHealthLight(game, health);
            this.spriteFont = game.Content.Load<SpriteFont>(Constants.GUI_FONT);

            string key = game.config.getValue("Controls", "Shoot");

            if (key == "Space")
            {
                lesserDemonTut = new TutorialString(spriteBatch, game, "shoot", spriteFont, key, Constants.TUTORIAL_BUTTON_FRAME_XLLARGE, new Vector2(120.0f, 0f));
            }
            else if (key == "Enter")
            {
                lesserDemonTut = new TutorialSprite(spriteBatch, game, "shoot", Constants.TUTORIAL_BUTTON_ENTER, Constants.TUTORIAL_BUTTON_FRAME_ENTER, new Vector2(120.0f, 0f));
            }
            else if (key == "LeftShift" || key == "RightShift" || key == "LeftAlt" || key == "RightAlt")
            {
                lesserDemonTut = new TutorialSprite(spriteBatch, game, "shoot", Constants.TUTORIAL_BUTTON_SHIFT, Constants.TUTORIAL_BUTTON_FRAME_LARGE, new Vector2(120.0f, 0f));
            }
            else
            {
                lesserDemonTut = new TutorialString(spriteBatch, game, "shoot", spriteFont, key, Constants.TUTORIAL_BUTTON_FRAME, new Vector2(120.0f, 0f));
            }

            pointLight = new PointLight()
            {
                Color = new Vector4(float.Parse(game.lighting.getValue("PlayerLight", "ColorR")), float.Parse(game.lighting.getValue("PlayerLight", "ColorG")), float.Parse(game.lighting.getValue("PlayerLight", "ColorB")), float.Parse(game.lighting.getValue("PlayerLight", "ColorA"))),
                Power = float.Parse(game.lighting.getValue("PlayerLight", "Power")),
                LightDecay = int.Parse(game.lighting.getValue("PlayerLight", "LightDecay")),
                Position = new Vector3(0f, 0f, float.Parse(game.lighting.getValue("PlayerLight", "ZPosition"))),
                IsEnabled = true,
                renderSpecular = bool.Parse(game.lighting.getValue("PlayerLight", "Specular"))
            };
        }