Ejemplo n.º 1
0
        //Generate new item on the field.
        public static void ProduceItemInField(FrameAnimation enemyAnimation, Enemy enemy, ICollection<IItem> visibleItems)
        {
            Point2D itemPosition = new Point2D(0, 0);

            if (enemy is Zombie)
            {
                if (enemyAnimation.SpriteEffect == SpriteEffects.None)
                {
                    itemPosition = new Point2D(enemyAnimation.Position.X, enemyAnimation.Position.Y + MovingDistanceStomper);
                }
                else
                {
                    itemPosition = new Point2D(enemyAnimation.Position.X + 100, enemyAnimation.Position.Y + MovingDistanceStomper);
                }

                visibleItems.Add(new Stomper("Stomper", itemPosition, OrusTheGame.Instance.Content));

            }
            else if (enemy is Skeleton)
            {

                if (enemyAnimation.SpriteEffect == SpriteEffects.None)
                {
                    itemPosition = new Point2D(enemyAnimation.Position.X, enemyAnimation.Position.Y + MovingDistanceArmour);
                }
                else
                {
                    itemPosition = new Point2D(enemyAnimation.Position.X + 100, enemyAnimation.Position.Y + MovingDistanceArmour);
                }

                visibleItems.Add(new GiantArmour("GiantArmour", itemPosition, OrusTheGame.Instance.Content));
            }
        }
Ejemplo n.º 2
0
 protected AttackingGameObject(string name, Point2D position, Rectangle2D boundingBox, float moveSpeed,
      int health, int armor, double fireResistance, double lightingResistance, 
      double arcaneResistance, double iceResistance,
      int attackDamage, int attackRange, float attackSpeed, float timeUntilDamageSinceAttack)
     : base(name, position, boundingBox)
 {
     this.AttackDamage = attackDamage;
     this.AttackRange = attackRange;
     this.AttackSpeed = attackSpeed;
     this.TimeUntilDamageSinceAttack = timeUntilDamageSinceAttack;
     this.MaxHealth = health;
     this.Health = health;
     this.Armor = armor;
     this.FireResistance = fireResistance;
     this.LightingResistance = lightingResistance;
     this.ArcaneResistance = arcaneResistance;
     this.IceResistance = iceResistance;
     this.Bar = new Sprite("Sprites\\Bars\\Bar", this.Position);
     this.Bar.IsActive = true;
     this.MoveSpeed = moveSpeed;
 }
Ejemplo n.º 3
0
 public Sprite(string path, Point2D position)
 {
     this.Texture = new Texture2DSubstitude(path);
     this.Position = position;
 }
Ejemplo n.º 4
0
 protected ColliderObject(string name, Point2D position)
     : base(name, position)
 {
 }
Ejemplo n.º 5
0
 protected AnimatedGameObject(string name, Point2D position, Rectangle2D boundingBox)
     : base(name, position)
 {
     this.BoundingBox = boundingBox;
     this.AnimationSpeed = Constant.DefaultAnimationSpeed;
 }
Ejemplo n.º 6
0
 protected GameObject(string name, Point2D position)
 {
     this.Name = name;
     this.Position = position;
 }
Ejemplo n.º 7
0
        public void Update()
        {
            var mouseState = Mouse.GetState();

            Point2D mouseCoordinates = new Point2D(
                mouseState.X - this.DifferenceInPositionFromLoad.X,
                mouseState.Y - this.DifferenceInPositionFromLoad.Y);
            //if ((mouseState.LeftButton == ButtonState.Pressed))
            //{
            //    Debug.WriteLine(mouseState.X + " " + mouseState.Y);
            //}

            //New Game BTN
            CheckNewGame(mouseState, mouseCoordinates);
            //Load Game BTN
            CheckLoadGame(mouseState, mouseCoordinates);
            //Credits BTN
            CheckCredits(mouseState, mouseCoordinates);
            //Options BTN
            CheckOptions(mouseState, mouseCoordinates);
            //Back From Credits BTN / Back From Options
            CheckBackButton(mouseState, mouseCoordinates);
            //Quit BTN
            CheckQuit(mouseState, mouseCoordinates);
            //Music BTN
            CheckMusicOnOff(mouseState, mouseCoordinates);

            if (MusicOn == false)
            {
                MediaPlayer.Stop();
            }
            if ((IsMenuActive == false) && (MusicOn == true))
            {
                MediaPlayer.Play(Music[1].Song);
            }
        }
Ejemplo n.º 8
0
 public void CheckQuit(MouseState mouseState, Point2D mouseCoordinates)
 {
     if (this.QuitButton.ButtonPressed(mouseState, this.MainMenuBackground, mouseCoordinates))
     {
         this.QuitButton.IsButtonPressed = true;
     }
     if (this.QuitButton.IsButtonPressed)
     {
         if (this.QuitButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
             (mouseState.LeftButton == ButtonState.Released))
         {
             OrusTheGame.Instance.Exit();
             this.QuitButton.IsButtonPressed = false;
         }
         else if (mouseState.LeftButton == ButtonState.Released)
         {
             this.QuitButton.IsButtonPressed = false;
         }
     }
 }
Ejemplo n.º 9
0
        public void CheckOptions(MouseState mouseState, Point2D mouseCoordinates)
        {
            if (this.OptionsButton.ButtonPressed(mouseState, this.MainMenuBackground, mouseCoordinates))
            {
                this.OptionsButton.IsButtonPressed = true;
            }
            if (this.OptionsButton.IsButtonPressed)
            {
                if (this.OptionsButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
                    (mouseState.LeftButton == ButtonState.Released))
                {
                    if (MusicOn)
                    {
                        MusicOnOffButtonImage[0].IsActive = true;
                        MusicOnOffButtonImage[1].IsActive = false;
                    }
                    else
                    {
                        MusicOnOffButtonImage[0].IsActive = false;
                        MusicOnOffButtonImage[1].IsActive = true;
                    }

                    MainMenuBackground.IsActive = false;
                    OptionsMenuBackground.IsActive = true;
                    this.OptionsButton.IsButtonPressed = false;
                }
                else if (mouseState.LeftButton == ButtonState.Released)
                {
                    this.OptionsButton.IsButtonPressed = false;
                }
            }
        }
Ejemplo n.º 10
0
 public void CheckNewGame(MouseState mouseState, Point2D mouseCoordinates)
 {
     if (this.NewGameButton.ButtonPressed(mouseState, this.MainMenuBackground, mouseCoordinates))
     {
         this.NewGameButton.IsButtonPressed = true;
     }
     if (this.NewGameButton.IsButtonPressed)
     {
         if (this.NewGameButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
             (mouseState.LeftButton == ButtonState.Released))
         {
             OrusTheGame.Instance.GameInformation.NewGame();
             this.IsMenuActive = false;
             this.CharacterSelectionInProgress = true;
             this.NewGameButton.IsButtonPressed = false;
             this.HasLoaded = true;
         }
         else if (mouseState.LeftButton == ButtonState.Released)
         {
             this.NewGameButton.IsButtonPressed = false;
         }
     }
 }
Ejemplo n.º 11
0
 public void CheckMusicOnOff(MouseState mouseState, Point2D mouseCoordinates)
 {
     if (this.MusicOnOffButton.ButtonPressed(mouseState, this.OptionsMenuBackground, mouseCoordinates))
     {
         this.MusicOnOffButton.IsButtonPressed = true;
     }
     if (this.MusicOnOffButton.IsButtonPressed)
     {
         if (this.MusicOnOffButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
             (mouseState.LeftButton == ButtonState.Released))
         {
             if ((this.MusicOn == true))
             {
                 this.MusicOn = false;
                 this.MusicOnOffButtonImage[1].IsActive = true;
                 this.MusicOnOffButtonImage[0].IsActive = false;
             }
             else if ((this.MusicOn == false))
             {
                 this.MusicOn = true;
                 MediaPlayer.Play(Music[0].Song);
                 this.MusicOnOffButtonImage[1].IsActive = false;
                 this.MusicOnOffButtonImage[0].IsActive = true;
             }
             this.MusicOnOffButton.IsButtonPressed = false;
         }
         else if (mouseState.LeftButton == ButtonState.Released)
         {
             this.MusicOnOffButton.IsButtonPressed = false;
         }
     }
 }
Ejemplo n.º 12
0
 public void CheckLoadGame(MouseState mouseState, Point2D mouseCoordinates)
 {
     if (this.LoadGameButton.ButtonPressed(mouseState, this.MainMenuBackground, mouseCoordinates))
     {
         this.LoadGameButton.IsButtonPressed = true;
     }
     if (this.LoadGameButton.IsButtonPressed)
     {
         if (this.LoadGameButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
             (mouseState.LeftButton == ButtonState.Released))
         {
             if (this.HasLoaded)
             {
                 this.IsMenuActive = false;
             }
             else
             {
                 DataManager.Data.Load();
             }
             this.LoadGameButton.IsButtonPressed = false;
         }
         else if (mouseState.LeftButton == ButtonState.Released)
         {
             this.LoadGameButton.IsButtonPressed = false;
         }
     }
 }
Ejemplo n.º 13
0
 public void CheckCredits(MouseState mouseState, Point2D mouseCoordinates)
 {
     if (this.CreditsButton.ButtonPressed(mouseState, this.MainMenuBackground, mouseCoordinates))
     {
         this.CreditsButton.IsButtonPressed = true;
     }
     if (this.CreditsButton.IsButtonPressed)
     {
         if (this.CreditsButton.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
             (mouseState.LeftButton == ButtonState.Released))
         {
             this.MainMenuBackground.IsActive = false;
             this.CreditsBackground.IsActive = true;
             this.CreditsInfo.IsActive = true;
             this.CreditsButton.IsButtonPressed = false;
         }
         else if (mouseState.LeftButton == ButtonState.Released)
         {
             this.CreditsButton.IsButtonPressed = false;
         }
     }
 }
Ejemplo n.º 14
0
 public bool ButtonPressed(MouseState mouseState, Sprite background, Point2D mouseCoordinates)
 {
     return this.ButtonLocation.AsRectangle().Contains((int)mouseCoordinates.X, (int)mouseCoordinates.Y) &&
         (mouseState.LeftButton == ButtonState.Pressed) && (background.IsActive == true);
 }