private Battery GetBatteryValuesFromIntent(Intent intent) { int statusExtra = intent.GetIntExtra(BatteryManager.ExtraStatus, -1); BatteryStatus status = this.GetBatteryStatus(statusExtra); int healthExtra = intent.GetIntExtra(BatteryManager.ExtraHealth, -1); BatteryHealth health = this.GetBatteryHealth(healthExtra); float tempExtra = intent.GetIntExtra(BatteryManager.ExtraTemperature, -1); string techExtra = intent.GetStringExtra(BatteryManager.ExtraTechnology); int voltage = intent.GetIntExtra(BatteryManager.ExtraVoltage, -1); return(new Battery { Level = intent.GetIntExtra(BatteryManager.ExtraLevel, 0), Scale = intent.GetIntExtra(BatteryManager.ExtraScale, -1), Status = status, Health = health, Temperature = tempExtra, Technology = techExtra, Voltage = voltage }); }
// Use this for initialization void Start() { //currentLives = startingLives; vpnHUDImage.SetActive(false); tvPlayer = FindObjectOfType <PlayerController>(); evolveScript = FindObjectOfType <Evolve>(); batteryHealthScript = FindObjectOfType <BatteryHealth>(); boss1 = FindObjectOfType <Boss>(); playerGunScript = FindObjectOfType <PlayerGun>(); playerRouterScript = FindObjectOfType <PlayerRouter>(); levelEndScript = FindObjectOfType <LevelEnd>(); gunPickupScript = FindObjectOfType <GunPickup>(); routerPickupScript = FindObjectOfType <RouterPickup>(); //***********************LOADING SAVE DATA******************************************** if (PlayerPrefs.HasKey("ShieldChargeCount")) { playerRouterScript.shieldChargeCount = PlayerPrefs.GetInt("ShieldChargeCount"); } playerRouterScript.shieldChargeText.text = playerRouterScript.shieldChargeCount.ToString(); if (PlayerPrefs.HasKey("HasRouter")) { tvPlayer.hasRouter = PlayerPrefs.GetInt("HasRouter"); } if (PlayerPrefs.HasKey("HasVPN")) { tvPlayer.hasVPN = PlayerPrefs.GetInt("HasVPN"); } if (PlayerPrefs.HasKey("HasGun")) { tvPlayer.hasGun = PlayerPrefs.GetInt("HasGun"); } //Checks for if you have phaser bullets. If there you do, it will load those back. //CODE GOES HERE // if (PlayerPrefs.HasKey("PhaserBulletCount")) { playerGunScript.phaserBulletCount = PlayerPrefs.GetInt("PhaserBulletCount"); } playerGunScript.phaserBulletText.text = playerGunScript.phaserBulletCount.ToString(); //Checks for if you have memory cards, and if there is value, load it back. if (PlayerPrefs.HasKey("MemCount")) { memCount = PlayerPrefs.GetInt("MemCount"); } memText.text = memCount.ToString(); //Checks for if you have upgrades, and if there is a value, load it back. if (PlayerPrefs.HasKey("UpgradeCount")) { upgradeCount = PlayerPrefs.GetInt("UpgradeCount"); } upgradeText.text = upgradeCount.ToString(); //Checks for if you have lives, and if there is value, load it back. if (PlayerPrefs.HasKey("PlayerLives")) { currentLives = PlayerPrefs.GetInt("PlayerLives"); } else { currentLives = startingLives; } //currentLives = startingLives; livesText.text = "x " + currentLives; objectsToReset = FindObjectsOfType <ResetOnRespawn>(); }