/// <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); }
/// <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) { currentMouseState = Mouse.GetState(); if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && quitRectanglePosition.Contains(currentMouseState.X, currentMouseState.Y)) { Quit(); } if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && nextTurnRectanglePosition.Contains(currentMouseState.X, currentMouseState.Y)) { int currentTurn = Turn.getCurrentTurn(); if (currentTurn == Turn.getLastTurn()) { //End Game Component this.Visible = false; //Score saved } else { Turn.setCurrentTurn(currentTurn + 1); Souls.endOfTurn(); NextTurn(); } } pastMouseState = currentMouseState; base.Update(gameTime); }
public void returnSouls() { if (PointAndCurency.GetSouls() > 0) { pew.Play(); Souls.returnSoul(Zone.GetSelectedZone()); } }
public override void Update(GameTime gameTime) { // TODO: Add your update code here currentMouseState = Mouse.GetState(); if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && easybuttonbuttonrectanglepos.Contains(currentMouseState.X, currentMouseState.Y)) { PointAndCurency.SetGold(10000); for (int x = 0; x < 20; x++) { Souls.createSoul(); } PointAndCurency.SetSouls(Souls.souls.Count); Turn.setDifficulty("easy"); StartNewGame(); } if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && normalbuttonrectanglepos.Contains(currentMouseState.X, currentMouseState.Y)) { PointAndCurency.SetGold(5000); for (int x = 0; x < 15; x++) { Souls.createSoul(); } PointAndCurency.SetSouls(Souls.souls.Count); Turn.setDifficulty("normal"); StartNewGame(); } if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && expertbuttonrectanglepos.Contains(currentMouseState.X, currentMouseState.Y)) { PointAndCurency.SetGold(3000); for (int x = 0; x < 10; x++) { Souls.createSoul(); } PointAndCurency.SetSouls(Souls.souls.Count); Turn.setDifficulty("hard"); StartNewGame(); } pastMouseState = currentMouseState; base.Update(gameTime); }
void endOfTurnGui_VisibleChanged(object sender, EventArgs e) { if (endOfTurnGui.Visible == false && splashScreen.Visible == false) { if (endOfTurnGui.quitSession == false && Turn.getCurrentTurn() < Turn.getLastTurn()) { //Add end turn button component endTurnButton.Visible = true; endTurnButton.Enabled = true; //Map is made visible mapComponent.Visible = true; mapComponent.Enabled = true; //PointSystem is visible pointSystemComponent.Visible = true; pointSystemComponent.Enabled = true; //Selection - green square made visible selectionComponent.Visible = true; selectionComponent.Enabled = true; //Turn Component made visible turnComponent.Visible = true; turnComponent.Enabled = true; //Allows the zoneGui thread to run zoneGui.Visible = true; zoneGui.Enabled = true; currencyController.Visible = true; currencyController.Enabled = true; } if (endOfTurnGui.quitSession == true) { //Add end turn button component endTurnButton.Visible = false; endTurnButton.Enabled = false; //Map is made visible mapComponent.Visible = false; mapComponent.Enabled = false; //PointSystem is visible pointSystemComponent.Visible = false; pointSystemComponent.Enabled = false; //Selection - green square made visible selectionComponent.Visible = false; selectionComponent.Enabled = false; //CurrencyController made visible currencyController.Visible = false; currencyController.Enabled = false; //Turn Component made visible turnComponent.Visible = false; turnComponent.Enabled = false; //Allows the zoneGui thread to run zoneGui.Visible = false; zoneGui.Enabled = false; mapComponent.Visible = false; mapComponent.Enabled = false; newgame.Visible = true; newgame.Enabled = true; } if (Turn.getCurrentTurn() == Turn.getLastTurn()) { Souls.endOfGame(); endOfTurnGui.Enabled = false; endOfTurnGui.Visible = false; mapComponent.Visible = false; resultscreen.Visible = true; pointSystemComponent.Visible = false; } } }
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 //} }