Squaby Demo
import QtQuick 2.0
QtObject {
id: player
property int gold: balancingSettings ? balancingSettings.playerStartGold : 999
property int lives: balancingSettings ? balancingSettings.playerStartLives : 999
property int wave: 1
property int score: 0
property int instantBonus: 0
property int nailgunsBuilt: 0
property int flamethrowersBuilt: 0
property int tasersBuilt: 0
property int teslasBuilt: 0
property int turbinesBuilt: 0
property int towersBuilt: nailgunsBuilt+flamethrowersBuilt+turbinesBuilt+tasersBuilt+teslasBuilt
property int nailgunsDestroyed: 0
property int flamethrowersDestroyed: 0
property int tasersDestroyed: 0
property int teslasDestroyed: 0
property int turbinesDestroyed: 0
property int towersDestroyed: nailgunsDestroyed+flamethrowersDestroyed+turbinesDestroyed+tasersDestroyed+teslasDestroyed
property int nailgunsActive: nailgunsBuilt-nailgunsDestroyed
property int flamethrowersActive: flamethrowersBuilt-flamethrowersDestroyed
property int tasersActive: tasersBuilt-tasersDestroyed
property int teslasActive: teslasBuilt-teslasDestroyed
property int turbinesActive: turbinesActive-turbinesDestroyed
property int towersActive: nailgunsActive+flamethrowersActive+turbinesActive+tasersActive+teslasActive
property int squabiesBuiltInCurrentWave: 0
property variant balancingSettings
function addPlayerPropertiesToAnalyticsObject(object) {
object.gold = gold
object.lives = lives
object.wave = wave
object.score = score
object.instantBonus = instantBonus
object.nailgunsBuilt = nailgunsBuilt
object.flamethrowersBuilt = flamethrowersBuilt
object.tasersBuilt = tasersBuilt
object.teslasBuilt = teslasBuilt
object.turbinesBuilt = turbinesBuilt
object.towersBuilt = towersBuilt
object.nailgunsDestroyed = nailgunsDestroyed
object.flamethrowersDestroyed = flamethrowersDestroyed
object.tasersDestroyed = tasersDestroyed
object.teslasDestroyed = teslasDestroyed
object.turbinesDestroyed = turbinesDestroyed
object.towersDestroyed = towersDestroyed
object.nailgunsActive = nailgunsActive
object.flamethrowersActive = flamethrowersActive
object.tasersActive = tasersActive
object.teslasActive = teslasActive
object.turbinesActive = turbinesActive
object.towersActive = towersActive
object.squabiesBuiltInCurrentWave = squabiesBuiltInCurrentWave
}
onWaveChanged: {
if(wave > 1) {
}
}
onLivesChanged: {
if(lives <= 0 && !scene.itemEditor.visible) {
console.debug("Game over, score:", score)
if(scene)
scene.exitScene()
window.state = "gameover"
}
}
function initializeProperties() {
gold = balancingSettings.playerStartGold
lives = balancingSettings.playerStartLives
wave = 1
score = 0
instantBonus = 0
nailgunsBuilt = 0
flamethrowersBuilt = 0
tasersBuilt = 0
teslasBuilt = 0
turbinesBuilt = 0
nailgunsDestroyed = 0
flamethrowersDestroyed = 0
tasersDestroyed = 0
teslasDestroyed = 0