Beispiel #1
0
        public bool attemptDie()
        {
            //On-death powerup activation
            if (HasPowerup("Retro"))
            {
                if (Powerups["Retro"] is RetroPort && History.CanRevert() && RetroGame.AvailableSand > 0)
                {
                    Powerups["Retro"].Activate(InputAction.None);
                    return(false);
                }
            }
            else if (HasPowerup("Health"))
            {
                if (Powerups["Health"] is FullHealthPickup)
                {
                    Powerups["Health"].Activate(InputAction.None);
                    return(false);
                }
            }

            SoundManager.PlaySoundOnce("PlayerDead", playInReverseDuringReverse: true);

            Alive = false;
            if (RetroGame.getMainLiveHero() == null)
            {
                RetroGame.GameOver();
                return(true);
            }

            LevelManager levelManager = RetroGame.EscapeScreen.levelManager;

            levelManager.SetCameraMode(RetroGame.EscapeScreen.levelManager.CameraMode);
            return(true);
        }
Beispiel #2
0
        public static void PreDraw()
        {
            float storeCharge    = RetroGame.StoreCharge;
            Color unchargedColor = STORE_UNCHARGED_COLOR;
            Color storeColor     = (storeCharge >= 1) ? STORE_FULLYCHARGED_COLOR : STORE_PARTLYCHARGED_COLOR;

            graphicsDevice.SetRenderTarget(storeIconTarget);
            graphicsDevice.Clear(Color.Transparent);
            Effect effect = Effects.StoreIconShading;

            effect.Parameters["unchargedColor"].SetValue(unchargedColor.ToVector4());
            effect.Parameters["chargedColor"].SetValue(storeColor.ToVector4());
            effect.Parameters["shadingPercentage"].SetValue(storeCharge);

            if (storeCharge >= 1)
            {
                storeSpriteBatch.Begin();
                byte alpha = (byte)(storeBorderInterp * 255);
                storeSpriteBatch.Draw(storeIconBorder, Vector2.Zero, STORE_FULLYCHARGED_COLOR.withAlpha(alpha));
                Hero mainPlayer = RetroGame.getMainLiveHero();
                if (mainPlayer != null)
                {
                    SpriteFont startFont       = (mainPlayer.currentInputType == InputType.Keyboard) ? RetroGame.FONT_HUD_KEYS : RetroGame.FONT_HUD_XBOX;
                    string     startString     = mainPlayer.bindings.getHUDIconCharacter(mainPlayer.currentInputType, InputAction.Start);
                    float      storeStartScale = (mainPlayer.currentInputType == InputType.Keyboard) ? STORE_START_KEY_SCALE : STORE_START_BUTTON_SCALE;
                    storeSpriteBatch.DrawString(startFont, startString, new Vector2(storeIconTarget.Width / 2f, storeIconTarget.Height / 2f), Color.White.withAlpha(alpha), 0, new Vector2(startFont.MeasureString(startString).X / 2, 0), storeStartScale, SpriteEffects.None, 0);
                }
                storeSpriteBatch.End();
            }
            storeSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp,
                                   DepthStencilState.None, RasterizerState.CullCounterClockwise, effect);
            storeSpriteBatch.Draw(storeIcon, new Vector2(storeIconTarget.Width / 2f, storeIconTarget.Height / 4f), null, Color.White, 0, new Vector2(storeIcon.Width / 2f, storeIcon.Height / 2f), 1, SpriteEffects.None, 0);
            storeSpriteBatch.End();
        }
Beispiel #3
0
        public void SetCameraMode(CameraMode mode)
        {
            switch (mode)
            {
            case CameraMode.Arena:
                ArenaCamera arenaCamera = new ArenaCamera(new Vector2((RetroGame.getMainLiveHero().levelX + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2, (RetroGame.getMainLiveHero().levelY + 0.5f) * Level.TEX_SIZE + Level.TILE_SIZE / 2));
                arenaCamera.Initialize();
                if (Camera != null)
                {
                    arenaCamera.InitializeWithCamera(Camera);
                }
                Camera = arenaCamera;
                break;

            case CameraMode.Escape:
                EscapeCamera escapeCamera;
                if (RetroGame.NUM_PLAYERS == 1)
                {
                    escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero());
                }
                else     //if (RetroGame.NUM_PLAYERS == 2)
                {
                    int liveHeroes = 0;
                    foreach (Hero hero in RetroGame.getHeroes())
                    {
                        if (hero.Alive)
                        {
                            liveHeroes++;
                        }
                    }
                    if (liveHeroes == 1)
                    {
                        escapeCamera = new EscapeCamera(RetroGame.getMainLiveHero());
                    }
                    else
                    {
                        escapeCamera = new CoopEscapeCamera(RetroGame.getHeroes()[0], RetroGame.getHeroes()[1]);
                    }
                }
                escapeCamera.Initialize();
                if (Camera != null)
                {
                    escapeCamera.InitializeWithCamera(Camera);
                }
                Camera = escapeCamera;
                break;
            }
            CameraMode = mode;
        }