Example #1
0
        private void SetWeaponPowerUpTexture(WeaponType type)
        {
            switch (type)
            {
            case WeaponType.Shotgun:
                Texture = TextureBank.GetTexture("Item_S");
                break;

            case WeaponType.Rifle:
                Texture = TextureBank.GetTexture("Item_L");
                break;

            case WeaponType.Plasma:
                Texture = TextureBank.GetTexture("Item_P");
                break;

            case WeaponType.Repeater:
                Texture = TextureBank.GetTexture("Item_R");
                break;

            default:
                Texture = TextureBank.GetTexture("PlasmaIcon");
                break;
            }
        }
Example #2
0
        public void LoadContent(World world)
        {
            m_Direction = new Vector2(0, 0);
            foreach (string s in m_BlinkingTextures)
            {
                TextureBank.GetTexture(s);
            }
            m_Texture = TextureBank.GetTexture(m_BlinkingTextures[0]);

            Width  = m_Texture != null ? m_Texture.Width : 0;
            Height = m_Texture != null ? m_Texture.Height : 0;

            if (m_Texture != null)
            {
                m_Bounds.Width  = Width;
                m_Bounds.Height = Height;
                m_Bounds.X      = (int)Position.X - Width / 2;
                m_Bounds.Y      = (int)Position.Y - Height / 2;
                m_Origin.X      = Width / 2;
                m_Origin.Y      = Height / 2;
            }

            _circleBody               = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(35 / 2f), 1f, ConvertUnits.ToSimUnits(Position));
            _circleBody.BodyType      = BodyType.Dynamic;
            _circleBody.Mass          = 5f;
            _circleBody.LinearDamping = 3f;
            _circleBody.Restitution   = .5f;

            circleCenter    = Position;
            circleCenter.Y += circleRadius;

            puffExplosion = new Puff();
        }
Example #3
0
        private void CreateCheat()
        {
            string temp;

            switch (CheatType)
            {
            case CheatTypes.Wrath:
                temp        = "Powerup";
                CheatEffect = new WrathEffect();
                break;

            case CheatTypes.Health:
                temp        = "MedPack";
                CheatEffect = new HealthEffect();
                break;

            case CheatTypes.Heart:
                temp        = "MedPack";
                CheatEffect = new HeartEffect();
                break;

            case CheatTypes.Time:
                temp        = "Clock";
                CheatEffect = new AddTimeEffect();
                break;

            default:
                temp        = "Powerup";
                CheatEffect = new WrathEffect();
                break;
            }
            Texture = TextureBank.GetTexture(temp);
        }
Example #4
0
 protected override void LoadTextures()
 {
     AnimationInfo[] array = new AnimationInfo[2];
     array[0]        = new AnimationInfo(TextureBank.GetTexture(shotString1), CHARGE_TIME);
     array[1]        = new AnimationInfo(TextureBank.GetTexture(shotString2), -1);
     m_FireAnimation = new AnimationManager(array, m_SavedShotInfo, 60);
 }
Example #5
0
        private MenuCategory CreateCheatUpgradeMenu()
        {
            int NumberOfCheats = 6;

            SelectionUpgradeWidth = MenuSelectionTotalArea.Height / NumberOfCheats;
            Rectangle          temp         = new Rectangle(0, 0, MenuSelectionTotalArea.Width, SelectionUpgradeWidth);
            MenuCategory       menu         = new MenuCategory("Cheats", UpgradeCheatsRec, "Upgrade Cheats", Color.Red, MenuSelectionTotalArea);
            List <UpgradeSlot> upgradeSlots = new List <UpgradeSlot>();

            //base widget tree
            for (int i = 0; i < NumberOfCheats; ++i)
            {
                Color      tempColor        = new Color(250 - (75 * i), 75 * i, 50 - (i * 10));
                WidgetTree tree             = new WidgetTree(temp);
                Rectangle  baseSlotDrawArea = new Rectangle(Viewport.Width / 2, SelectionUpgradeWidth / 2, SelectionUpgradeWidth, MenuSelectionTotalArea.Width);
                tree.AddDrawArea(baseSlotDrawArea, new ColorTexture(TextureBank.GetTexture("GSMbackground"), tempColor));
                Rectangle   currentSlotPosition = new Rectangle(0, (SelectionUpgradeWidth * i), temp.Width, temp.Height);
                UpgradeSlot slot = null;
                try
                {
                    slot = new UpgradeSlot(currentSlotPosition, ScreenManager, ScreenManager.Font);
                }
                catch (Exception)
                {
                }
                slot.SetWidgetTree(tree);
                upgradeSlots.Add(slot);
            }
            menu.SetUpgradeSlot(upgradeSlots);
            return(menu);
        }
Example #6
0
 private void HandleAnimation(object o, AnimationTimerEventArgs e)
 {
     Texture         = TextureBank.GetTexture(textures[e.FrameIndex]);
     m_Bounds.Width  = Texture.Width;
     m_Bounds.Height = Texture.Height;
     Origin          = new Vector2(Texture.Width / 2, Texture.Height / 2);
 }
Example #7
0
        public void LoadContent(ContentManager content, float width, float height)
        {
            TimeAlmostOut      = false;
            m_StatusBackground = content.Load <Texture2D>("Line");
            m_SpriteFont       = content.Load <SpriteFont>("Retrofont");
            ColunaFont         = content.Load <SpriteFont>("ColunaFont");

            m_StatusBackgroundPosition = new Vector2(0, 0);
            m_StatusBackGroundScale    = Utilities.GetSpriteScaling(new Vector2(OFFSET, height), new Vector2(m_StatusBackground.Width, m_StatusBackground.Height));
            PlayfieldBottom            = OFFSET;
            GameWidth    = width;
            GameHeight   = height;
            m_Background = content.Load <Texture2D>("Louis-game-backgroundFULL");

            ActiveGibs.Clear();

            Vector2 viewport = new Vector2(GameWidth, GameHeight);
            Vector2 textSize = ColunaFont.MeasureString("00:00:00");

            DeathTimerScale = Utilities.GetSpriteScaling(new Vector2((int)((viewport.Y) * 0.5), (int)((viewport.X) * 0.5)), textSize);
            Vector2 textPosition = (viewport) / 2;

            DeathTimerPosition = textPosition;
            DeathTimerOrigin   = new Vector2(textSize.X / 2, textSize.Y / 2);

            textSize          = ColunaFont.MeasureString("00");
            CountdownScale    = Utilities.GetSpriteScaling(new Vector2((int)(viewport.Y * 0.45), (int)(viewport.X * 0.35)), textSize);
            CountdownPosition = textPosition;
            CountdownOrigin   = new Vector2(textSize.X / 2, textSize.Y / 2);

            m_HeartTexture    = TextureBank.GetTexture("Heart50x45");
            m_SkullBackground = TextureBank.GetTexture("isolatedSkullBG01");
        }
Example #8
0
 public static void LoadTextures()
 {
     if (m_Texture == null)
     {
         m_Texture = TextureBank.GetTexture("Face");
     }
     //TODO load exploded textures here
 }
Example #9
0
 public void Trigger()
 {
     animationTimer = new AnimationTimer(intervals, m_AnimationName, HandleAnimation, false);
     canDraw        = true;
     Texture        = TextureBank.GetTexture(textures[0]);
     ObjectManager.GetCell(Position).Add(this);
     Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
 }
Example #10
0
 public void SetBounds(Rectangle rec)
 {
     Bounds = rec;
     if (testTexture == null)
     {
         testTexture = TextureBank.GetTexture("blank");
     }
 }
Example #11
0
        public override void LoadContent()
        {
            int currentFrame = r.Next(8);

            animationTimer = new AnimationTimer(intervals, m_AnimationName, HandleAnimation, true, currentFrame);
            Texture        = TextureBank.GetTexture(textures[currentFrame]);
            base.LoadContent();
        }
Example #12
0
 public static void LoadTextures()
 {
     if (m_Texture == null)
     {
         m_Texture = TextureBank.GetTexture("kevinZombie");
     }
     TextureBank.GetTexture("ZombieBody");
     TextureBank.GetTexture("ZombieHead");
 }
Example #13
0
 private void HandleAnimation(object o, AnimationTimerEventArgs e)
 {
     switch (e.AnimationName)
     {
     case BlinkAnimationName:
         m_Texture = TextureBank.GetTexture(m_BlinkingTextures[e.FrameIndex]);
         break;
     }
 }
Example #14
0
 protected override void LoadTextures()
 {
     AnimationInfo[] array = new AnimationInfo[4];
     array[0]        = new AnimationInfo(TextureBank.GetTexture(blastString), 5);
     array[1]        = new AnimationInfo(TextureBank.GetTexture(blast2String), 9);
     array[2]        = new AnimationInfo(TextureBank.GetTexture(blast3String), 12);
     array[3]        = new AnimationInfo(TextureBank.GetTexture(blast4String), -1);
     m_FireAnimation = new AnimationManager(array, m_SavedShotInfo, 15);
 }
Example #15
0
        private MenuCategory CreateWeaponUpgradeMenu()
        {
            int NumberOfWeapons = 4;

            SelectionUpgradeWidth = MenuSelectionTotalArea.Height / NumberOfWeapons;
            MenuCategory       menu         = new MenuCategory("Weapons", UpgradeWeaponRec, "Upgrade Weapons", Color.Beige, MenuSelectionTotalArea);
            List <UpgradeSlot> upgradeSlots = new List <UpgradeSlot>();

            //base widget tree
            for (int i = 0; i < NumberOfWeapons; ++i)
            {
                Rectangle   temp = new Rectangle(0, 0, MenuSelectionTotalArea.Width, SelectionUpgradeWidth);
                Rectangle   currentSlotPosition = new Rectangle(0, (SelectionUpgradeWidth * i), temp.Width, temp.Height);
                UpgradeSlot slot = new UpgradeSlot(currentSlotPosition, ScreenManager, ScreenManager.Font);
                switch (i)
                {
                case 0:
                    slot.SetUpgradeField(UpgradeFieldEnum.ShotgunDamage, Upgrade_List[UpgradeFieldEnum.ShotgunDamage]);
                    break;

                case 1:
                    slot.SetUpgradeField(UpgradeFieldEnum.RifleDamage, Upgrade_List[UpgradeFieldEnum.RifleDamage]);
                    break;

                case 2:
                    slot.SetUpgradeField(UpgradeFieldEnum.PlasmaDamage, Upgrade_List[UpgradeFieldEnum.PlasmaDamage]);
                    break;

                default:
                    slot.SetUpgradeField(UpgradeFieldEnum.RifleDamage, Upgrade_List[UpgradeFieldEnum.RifleDamage]);
                    break;
                }
                Color      tempColor        = new Color(250 - (75 * i), 75 * i, 50 - (i * 10));
                WidgetTree tree             = new WidgetTree(temp);
                Rectangle  baseSlotDrawArea = new Rectangle(Viewport.Width / 2, SelectionUpgradeWidth / 2, SelectionUpgradeWidth, MenuSelectionTotalArea.Width);
                tree.AddDrawArea(baseSlotDrawArea, new ColorTexture(TextureBank.GetTexture("GSMbackground"), tempColor));
                WidgetTree slotTop          = new WidgetTree(new Rectangle(0, 0, baseSlotDrawArea.Width, baseSlotDrawArea.Height));
                Rectangle  tapButton        = new Rectangle(baseSlotDrawArea.Height / 2, baseSlotDrawArea.Width / 2, 150, 150);
                Rectangle  valueArea        = new Rectangle(tapButton.X - 200, tapButton.Y, 200, 100);
                Rectangle  descriptionArea  = new Rectangle(tapButton.X + 200, valueArea.Y, 200, 10);
                Rectangle  upgradeLevelArea = new Rectangle(descriptionArea.X - 50, descriptionArea.Y, 100, 10);
                slotTop.AddDrawArea(tapButton, new ColorTexture(TextureBank.GetTexture("GSMbackground"), Color.Black));
                slotTop.AddDrawArea(valueArea, slot.NextUpgradeCostString);
                slotTop.AddDrawArea(descriptionArea, slot.NameString);
                slotTop.AddDrawArea(upgradeLevelArea, slot.LevelString);
                slotTop.AddHitArea(tapButton);
                tree.AddWidgetTree(slotTop);

                slot.SetWidgetTree(tree);
                slot.Value = i * 100;
                upgradeSlots.Add(slot);
            }
            menu.SetUpgradeSlot(upgradeSlots);
            return(menu);
        }
Example #16
0
 public override void Load(World world)
 {
     if (m_Texture == null)
     {
         m_Texture = TextureBank.GetTexture("kevinZombie");
     }
     _circleBody               = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(35 / 2f), 1f, ConvertUnits.ToSimUnits(Position));
     _circleBody.BodyType      = BodyType.Dynamic;
     _circleBody.Mass          = 0.2f;
     _circleBody.LinearDamping = 2f;
     _circleBody.Position      = bodyPosition;
 }
Example #17
0
 public static void LoadTextures()
 {
     if (m_Texture == null)
     {
         m_Texture = TextureBank.GetTexture("Slime");
     }
     if (m_SlimeTrailTex == null)
     {
         m_SlimeTrailTex = TextureBank.GetTexture("SlimeTrail");
     }
     //TODO load slime exploded textures here
 }
Example #18
0
 public bool CheckCollision(GameObject ob)
 {
     if (Bounds.Intersects(ob.Bounds) && m_State == BulletState.Flying)
     {
         PlasmaHitAnimationTimer = new AnimationTimer(hitIntervals, m_HitAnimation, HandlePlasmaHitAnimation, false);
         Texture = TextureBank.GetTexture(hitTextures[0]);
         //play the bullet explosion animation here, make sure to remove bounds, it should be fast enough that nothing clips
         m_State = BulletState.Contact;
         return(true);
     }
     return(false);
 }
Example #19
0
 public WolfHand(LeftOrRightHand which, Wolf body)
 {
     if (which == LeftOrRightHand.Left)
     {
         Texture = TextureBank.GetTexture("kevinZombie");
     }
     else
     {
         Texture = TextureBank.GetTexture("kevinZombie");
     }
     WhichHand = which;
     Position  = body.Position;
 }
Example #20
0
 public void LoadContent(World world)
 {
     m_InitialPosition = Position;
     Texture           = TextureBank.GetTexture("Player");
     base.LoadContent();
     foreach (Weapon w in m_Weapons)
     {
         w.LoadContent();
     }
     _circleBody               = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(35 / 2f), 1f, ConvertUnits.ToSimUnits(Position));
     _circleBody.BodyType      = BodyType.Dynamic;
     _circleBody.Mass          = 4f;
     _circleBody.LinearDamping = 2f;
     if (!float.IsNaN(this.Position.X) && !float.IsNaN(this.Position.Y))
     {
         _circleBody.Position = ConvertUnits.ToSimUnits(this.Position);
     }
     RedFlashTexture = TextureBank.GetTexture("RED");
 }
Example #21
0
        public void LoadContent(World world)
        {
            m_Direction = new Vector2(0, 0);
            m_Texture   = TextureBank.GetTexture("WolfBody");
            Width       = m_Texture != null ? m_Texture.Width : 0;
            Height      = m_Texture != null ? m_Texture.Height : 0;

            if (m_Texture != null)
            {
                m_Bounds.Width  = Width;
                m_Bounds.Height = Height;
                m_Bounds.X      = (int)Position.X - Width / 2;
                m_Bounds.Y      = (int)Position.Y - Height / 2;
                m_Origin.X      = Width / 2;
                m_Origin.Y      = Height / 2;
            }

            _circleBody               = BodyFactory.CreateCircle(world, ConvertUnits.ToSimUnits(35 / 2f), 1f, ConvertUnits.ToSimUnits(Position));
            _circleBody.BodyType      = BodyType.Dynamic;
            _circleBody.Mass          = 5f;
            _circleBody.LinearDamping = 3f;
            _circleBody.Restitution   = .5f;

            Lefthand  = new WolfHand(WolfHand.LeftOrRightHand.Left, this);
            Righthand = new WolfHand(WolfHand.LeftOrRightHand.Right, this);
            Lefthand.LoadContent();
            Righthand.LoadContent();

            moveHandsIntervals    = new float[5];
            moveHandsIntervals[0] = 1000;
            moveHandsIntervals[1] = 1000;
            moveHandsIntervals[2] = 1000;
            moveHandsIntervals[3] = 1000;
            moveHandsIntervals[4] = 1000;
            MoveHandsTimer        = new AnimationTimer(moveHandsIntervals, m_MoveHandsString, AnimationHandler, false);
        }
Example #22
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = ScreenManager.Game.Content;
            }

            //gameFont = content.Load<SpriteFont>("GSMgamefont");

            m_World = new World(new Vector2(0, 0));
            ConvertUnits.SetDisplayUnitToSimUnitRatio(5);

            Player p = Player.Load(content);

            if (p == null)
            {
                Vector2 playerPosition = new Vector2(Game1.GameWidth / 2, Game1.GameHeight / 2);
                m_Player.Init(content, playerPosition);
            }
            else
            {
                m_Player = p;
            }
            //init object manager and set objects for it
            GlobalObjectManager.Init(m_Player, content, m_World);
            TextureBank.SetContentManager(content);
            SoundBank.SetContentManager(content);
            m_Player.LoadContent(m_World);
            UserInterface.LoadContent(content, Game1.GameWidth, Game1.GameHeight);
            GlobalObjectManager.LoadContent();

            m_song = SoundBank.GetSong("PUNCHING-Edit");
            UserInterface.SetTimeToDeath(m_Player.TimeToDeath);

            Zombie.LoadTextures();
            Slime.LoadTextures();
            Anubis.LoadTextures();


            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundTexture = new RenderTarget2D(ScreenManager.GraphicsDevice, viewport.Width, viewport.Height, false,
                                                   SurfaceFormat.Color, DepthFormat.None, ScreenManager.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);


            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            GraphicsDevice device = ScreenManager.GraphicsDevice;

            device.SetRenderTarget(backgroundTexture);
            spriteBatch.Begin();
            UserInterface.DrawBackground(spriteBatch);
            spriteBatch.End();

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();

            m_World.Step(0f);

            isLoaded = true;
        }
Example #23
0
 protected override void LoadExplodedParts()
 {
     ExplodedParts.Add(TextureBank.GetTexture("ZombieBody"));
     ExplodedParts.Add(TextureBank.GetTexture("ZombieHead"));
 }
Example #24
0
 private void HandlePlasmaHitAnimation(object o, AnimationTimerEventArgs e)
 {
     Texture = TextureBank.GetTexture(hitTextures[e.FrameIndex]);
 }
Example #25
0
 protected override void LoadExplodedParts()
 {
     ExplodedParts.Add(TextureBank.GetTexture("SlimePart1"));
     ExplodedParts.Add(TextureBank.GetTexture("SlimePart2"));
     ExplodedParts.Add(TextureBank.GetTexture("SlimePart3"));
 }
Example #26
0
 public override void Load(FarseerPhysics.Dynamics.World world)
 {
     Texture = TextureBank.GetTexture("Powerup");
 }
Example #27
0
 public GraphicalLine()
 {
     blank  = TextureBank.GetTexture("Line");
     point1 = new Vector2();
     point2 = new Vector2();
 }