Ejemplo n.º 1
0
        public static void returnSoul(Zone zone)
        {
            int numSouls    = Convert.ToInt32(zone.getNumberOfSouls());
            int soulsOnHand = PointAndCurency.GetSouls();

            if (zone.GetZoneType() >= 2)
            {
                zone.setNumberOfSouls(numSouls + 1);
                PointAndCurency.SetSouls(soulsOnHand - 1);
            }



            /*foreach (var soul in souls)
             * {
             *  if (soul.soulName == "currency")
             *  {
             *      soul.soulName = "alive";
             *      soul.age = 0;
             *      soul.maxAge = random.Next(30, 140);
             *      soul.goodLevel = soul.goodLevel - 2;
             *
             *  }
             * }*/
        }
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            int currentSouls = PointAndCurency.GetSouls();

            currentMouseState = Mouse.GetState();
            if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && sellSoulsButtonPositionRectangle.Contains(currentMouseState.X, currentMouseState.Y))
            {
                if (currentSouls > 0)
                {
                    buttonClick.Play();
                    Souls.sellSoul();
                }
            }
            if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && getPointsButtonPositionRectangle.Contains(currentMouseState.X, currentMouseState.Y))
            {
                if (currentSouls > 0)
                {
                    buttonClick.Play();
                    Souls.scoreSoul();
                }
            }
            if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && buySoulsButtonPositionRectangle.Contains(currentMouseState.X, currentMouseState.Y))
            {
                buttonClick.Play();
                Souls.buySoul();
            }
            pastMouseState = currentMouseState;

            base.Update(gameTime);
        }
Ejemplo n.º 3
0
 public void returnSouls()
 {
     if (PointAndCurency.GetSouls() > 0)
     {
         pew.Play();
         Souls.returnSoul(Zone.GetSelectedZone());
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            goldAmount  = PointAndCurency.GetGold().ToString();
            soulAmount  = PointAndCurency.GetSouls().ToString();
            pointAmount = PointAndCurency.GetPoints().ToString();

            base.Update(gameTime);
        }
Ejemplo n.º 5
0
        public static void scoreSoul(int numSouls)
        {
            int currentPoints = PointAndCurency.GetPoints();
            int currentSouls  = PointAndCurency.GetSouls();
            int selling       = 0;

            foreach (var soul in souls)
            {
                if (soul.soulName == "currency" && selling < numSouls)
                {
                    currentPoints = (currentPoints + soul.goodLevel);
                    //currentSouls = currentSouls - 1;
                    selling++;
                    soul.soulName = "point";
                    PointAndCurency.SetSouls(currentSouls);
                    PointAndCurency.SetPoints(currentPoints);
                }
            }
        }
Ejemplo n.º 6
0
        public static void sellSoul()
        {
            int currentGold  = PointAndCurency.GetGold();
            int currentSouls = PointAndCurency.GetSouls();
            int selling      = 0;
            int soulID       = 0;

            foreach (var soul in souls)
            {
                if (soul.soulName == "currency" && selling == 0)
                {
                    currentSouls = currentSouls - 1;
                    currentGold  = currentGold + 75;
                    selling++;
                    soul.soulName = "sold";
                    PointAndCurency.SetSouls(currentSouls);
                    PointAndCurency.SetGold(currentGold);
                    soul.soulNumber = soulID;
                }
            }
        }
Ejemplo n.º 7
0
        protected override void LoadContent()
        {
            //values for strings
            pointAndCurency = new PointAndCurency();
            goldAmount      = PointAndCurency.GetGold().ToString();
            soulAmount      = PointAndCurency.GetSouls().ToString();
            pointAmount     = PointAndCurency.GetPoints().ToString();

            //setting position of strings holding currency values
            goldStringPosition  = new Vector2(330, 17);
            soulStringPosition  = new Vector2(440, 17);
            pointStringPosition = new Vector2(620, 17);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            //Loading textures
            goldCurrencyTexture       = Game.Content.Load <Texture2D>(@"sprites\goldCurrency");
            soulCurrencyTexture       = Game.Content.Load <Texture2D>(@"sprites\soulCurrency");
            pointCurrencyTexture      = Game.Content.Load <Texture2D>(@"sprites\pointCurrency");
            currencyContainterTexture = Game.Content.Load <Texture2D>(@"sprites\currencyContainer");

            //loading Fonts
            spriteFont = Game.Content.Load <SpriteFont>(@"fonts\CourierNew");

            currencyContainerDrawableRectangle = new Rectangle(0, 0, currencyContainterTexture.Bounds.Width, currencyContainterTexture.Bounds.Height);
            goldCurrencyDrawableRectangle      = new Rectangle(0, 0, goldCurrencyTexture.Bounds.Width, goldCurrencyTexture.Bounds.Height);
            soulCurrencyDrawableRectangle      = new Rectangle(0, 0, soulCurrencyTexture.Bounds.Width, soulCurrencyTexture.Bounds.Height);
            pointCurrencyDrawableRectangle     = new Rectangle(0, 0, pointCurrencyTexture.Bounds.Width, pointCurrencyTexture.Bounds.Height);

            //+200 is sending the whole component to the right
            currencyContainerPositionRectangle = new Rectangle(0 + 250, 0, currencyContainterTexture.Bounds.Width / 2, currencyContainterTexture.Bounds.Height / 2);
            goldCurrencyPositionRectangle      = new Rectangle(10 + 250, 10, goldCurrencyTexture.Bounds.Width / 2, goldCurrencyTexture.Bounds.Height / 2);
            soulCurrencyPositionRectangle      = new Rectangle(130 + 250, 10, soulCurrencyTexture.Bounds.Width / 2, soulCurrencyTexture.Bounds.Height / 2);
            pointCurrencyPositionRectangle     = new Rectangle(250 + 250, 15, pointCurrencyTexture.Bounds.Width / 2, pointCurrencyTexture.Bounds.Height / 2);

            //Loading Fonts


            base.LoadContent();
        }
Ejemplo n.º 8
0
        public static void buySoul()
        {
            int currentGold  = PointAndCurency.GetGold();
            int currentSouls = PointAndCurency.GetSouls();

            if (currentGold >= 100)
            {
                currentGold  = currentGold - 100;
                currentSouls = currentSouls + 1;
                PointAndCurency.SetSouls(currentSouls);
                PointAndCurency.SetGold(currentGold);
                allSoul++;
                souls.Add(new Soul
                {
                    soulNumber = allSoul,
                    soulName   = "currency",
                    age        = 0,
                    maxAge     = random.Next(30, 140),
                    goodLevel  = random.Next(-10, 35),
                    tileID     = 0
                });
            }
        }