public static void endOfGame() { int currentGold = PointAndCurency.GetGold(); int currentPoints = PointAndCurency.GetPoints(); if (currentGold >= 80) { currentGold = currentGold / 80; currentPoints = currentPoints + currentGold; } foreach (var soul in souls) { if (soul.soulName == "alive") { currentPoints = currentPoints + (soul.goodLevel - (soul.maxAge - soul.age)); PointAndCurency.SetPoints(currentPoints); } else if (soul.soulName == "currency") { currentPoints = PointAndCurency.GetPoints(); currentPoints = currentPoints + (soul.goodLevel / 2); PointAndCurency.SetPoints(currentPoints); } } }
/// <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); }
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; } } }
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(); }
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 }); } }
public void Upgrade() { if (zoneType == 1) { if (PointAndCurency.GetGold() >= 300) //cost 300 { PointAndCurency.subtractGold(300); zoneType = zoneType + 1; upgradeCost = 500; //new cost //numberOfSouls = 50; for (int x = 0; x < numberOfSouls; x++) { Souls.createSoul(); } } } else if (zoneType == 2) { if (PointAndCurency.GetGold() >= 500) //cost 500 { PointAndCurency.subtractGold(500); zoneType = zoneType + 1; upgradeCost = 700; //new cost //numberOfSouls = numberOfSouls + 50; for (int x = 0; x < 50; x++) { Souls.createSoul(); } } } else if (zoneType == 3) { if (PointAndCurency.GetGold() >= 700) //cost 700 { PointAndCurency.subtractGold(700); zoneType = zoneType + 1; upgradeCost = 1000; //new cost //numberOfSouls = numberOfSouls + 25; for (int x = 0; x < 25; x++) { Souls.createSoul(); } } } else if (zoneType == 4) { if (PointAndCurency.GetGold() >= 1000) //cost 1000 { PointAndCurency.subtractGold(1000); zoneType = zoneType + 1; upgradeCost = 0; //new cost //numberOfSouls = numberOfSouls + 25; for (int x = 0; x < 25; x++) { Souls.createSoul(); } } } //if (zoneType == (int)ZoneStates.Water) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Earth; // //} //} //if (zoneType == (int)ZoneStates.Earth) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Village; // //} //} //if (zoneType == (int)ZoneStates.Village) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Town; // //} //} //if (zoneType == (int)ZoneStates.Town) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.City; // //} //} //if (zoneType == (int)ZoneStates.City) //{ // //Message that zone is not upgradable any further //} }
public void Upgrade() { if (zoneType == 1) { if (PointAndCurency.GetGold() > 300) { PointAndCurency.subtractGold(300); zoneType = zoneType + 1; } } else if (zoneType == 2) { if (PointAndCurency.GetGold() > 500) { PointAndCurency.subtractGold(500); zoneType = zoneType + 1; } } else if (zoneType == 3) { if (PointAndCurency.GetGold() > 700) { PointAndCurency.subtractGold(700); zoneType = zoneType + 1; } } else if (zoneType == 4) { if (PointAndCurency.GetGold() > 1000) { PointAndCurency.subtractGold(1000); zoneType = zoneType + 1; } } //if (zoneType == (int)ZoneStates.Water) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Earth; // //} //} //if (zoneType == (int)ZoneStates.Earth) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Village; // //} //} //if (zoneType == (int)ZoneStates.Village) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.Town; // //} //} //if (zoneType == (int)ZoneStates.Town) //{ // //(If player has enough money resources) then do rest // To be implemented // //{ // zoneType = (int)ZoneStates.City; // //} //} //if (zoneType == (int)ZoneStates.City) //{ // //Message that zone is not upgradable any further //} }