package com.lucasdnd.ags.gameplay;
import com.lucasdnd.ags.gameplay.market.MarketGame;
/**
* This is the cartrige or cd that you can have in the store for rent or play.
*
* The Game's Mini Panel is located at the MarketGame Class. That's because it's referring to a MarketGame, not a single cartrige.
*
* @author tulio
*
*/
public class Game {
// The market game this cartrige/cd refers to
private MarketGame referredMarketGame;
private boolean rented; // Indicates if this game is currently rented or not
private boolean beingPlayed; // Indicates if this game is currently being played in the store or not
// Rent control
private int rentTimer; // Rent timer
private int rentTimeLimit; // Max rent time
// Disposal control
private boolean shouldBeRemoved;
/**
* Creates an instance of the cartrige/cd based on the Market Game
* @param marketGame
*/
public Game(MarketGame marketGame) {
// Stores the Market Game as a reference
this.referredMarketGame = marketGame;
// Basic attributes
rented = false;
beingPlayed = false;
// Rent control
rentTimer = 0;
rentTimeLimit = 60000; // 1 day in game time
}
/**
* Rent control
*/
public void update(int delta) {
// If the game is rented, count the time limit
if(rented) {
// Increase the count
rentTimer += delta;
// If we reached "24" hours (it's actually 10 in game time)
if(rentTimer >= rentTimeLimit) {
rentTimer = 0;
rented = false;
}
}
}
public MarketGame getReferredMarketGame() {
return referredMarketGame;
}
public void setReferredMarketGame(MarketGame referredMarketGame) {
this.referredMarketGame = referredMarketGame;
}
public boolean isRented() {
return rented;
}
public void setRented(boolean rented) {
this.rented = rented;
}
public boolean isBeingPlayed() {
return beingPlayed;
}
public void setBeingPlayed(boolean beingPlayed) {
this.beingPlayed = beingPlayed;
}
public int getRentTimer() {
return rentTimer;
}
public void setRentTimer(int rentTimer) {
this.rentTimer = rentTimer;
}
public int getRentTimeLimit() {
return rentTimeLimit;
}
public void setRentTimeLimit(int rentTimeLimit) {
this.rentTimeLimit = rentTimeLimit;
}
public boolean shouldBeRemoved() {
return shouldBeRemoved;
}
public void setShouldBeRemoved(boolean shouldBeRemoved) {
this.shouldBeRemoved = shouldBeRemoved;
}
}