private void UpdateSettings() { MatchDuration.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.MatchDuration, Properties.PlayerPrefsDefault.MatchDuration); HealthPoints.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.HealthPoints, Properties.PlayerPrefsDefault.HealthPoints); CanonDamage.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.CanonDamage, Properties.PlayerPrefsDefault.CanonDamage); CanonPower.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.CanonPower, Properties.PlayerPrefsDefault.CanonPower); TurretSpeed.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.TurretSpeed, Properties.PlayerPrefsDefault.TurretSpeed); ReloadTime.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ReloadTime, Properties.PlayerPrefsDefault.ReloadTime); WaypointSeekRadius.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.WaypointSeekRadius, Properties.PlayerPrefsDefault.WaypointSeekRadius); ExplosionDamage.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ExplosionDamage, Properties.PlayerPrefsDefault.ExplosionDamage); ExplosionRadius.Value = PlayerPrefs.GetInt(Properties.PlayerPrefs.ExplosionRadius, Properties.PlayerPrefsDefault.ExplosionRadius); ExplosionCreateBustedTank.isOn = PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.ExplosionCreateBustedTank, Properties.PlayerPrefsDefault.ExplosionCreateBustedTank); SecondsBetweenRefresh.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.SecondsBetweenRefresh, Properties.PlayerPrefsDefault.SecondsBetweenRefresh); AlwaysPickBestChoice.isOn = PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.AlwaysPickBestChoice, Properties.PlayerPrefsDefault.AlwaysPickBestChoice); GridGap.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.GridGap, Properties.PlayerPrefsDefault.GridGap); BonusPerSpawnNumber.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.BonusPerSpawnNumber, Properties.PlayerPrefsDefault.BonusPerSpawnNumber); BonusPerSpawnFrequency.Value = PlayerPrefs.GetFloat(Properties.PlayerPrefs.BonusPerSpawnFrequency, Properties.PlayerPrefsDefault.BonusPerSpawnFrequency); }
private void LoadData() { _randomColorOnStart = PlayerPrefsUtils.GetBool(RandomColorKey, true); _ballColor = PlayerPrefsUtils.GetColor(ColorKey, Color.white); _bestScore = PlayerPrefs.GetInt(BestScoreKey, 0); _controlType = PlayerPrefsUtils.GetEnum(ControlTypeKey, ControlType.ControlPanels); }
private void Die(TankEntity killer) { if (killer.Team == Team) { CurrentMatchReference.Value.TeamStats[Team].TeamKill++; } else { CurrentMatchReference.Value.TeamStats[killer.Team].KillCount++; } CurrentMatchReference.Value.TeamStats[Team].LossCount++; CurrentMatchReference.Value.TeamStats[Team].TankLeft--; if (CurrentMatchReference.Value.TeamStats[Team].TankLeft == 0) { CurrentMatchReference.Value.TeamStats[Team].IsDefeated = true; } if (CurrentMatchReference.Value.TeamInMatch.Count() == 1) { OnMatchFinished.Raise(); } // Explosion Instantiate(TankExplosionPrefab, transform.position, TankExplosionPrefab.transform.rotation); int size = Physics.OverlapSphereNonAlloc(transform.position, ExplosionRadius, _hitColliders); for (int i = 0; i < size; i++) { TankEntity tankEntity = _hitColliders[i].GetComponent <TankEntity>(); if (tankEntity && tankEntity != this) { tankEntity.DamageByExplosion(this); } } // Wreck if (PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.ExplosionCreateBustedTank, Properties.PlayerPrefsDefault.ExplosionCreateBustedTank)) { Instantiate(BustedTankPrefab, transform.position, transform.rotation); } // Remove from list TanksReference.Value.Remove(gameObject); // Destroy Destroy(gameObject); }
// End of custom references private void Awake() { TankEntity = GetComponent <TankEntity>(); TimeBetweenRefresh = PlayerPrefs.GetInt(Properties.PlayerPrefs.SecondsBetweenRefresh, Properties.PlayerPrefsDefault.SecondsBetweenRefresh); AlwaysPickBestChoice = PlayerPrefsUtils.GetBool(Properties.PlayerPrefs.AlwaysPickBestChoice, Properties.PlayerPrefsDefault.AlwaysPickBestChoice); }