private void HandleOfflineProgress()
    {
        if ((bool)dataSavingManager.GetOtherValue("UnlockedAuto"))
        {
            PlayerData playerData     = dataSavingManager.GetPlayerData();
            double     secondsOffline = (DateTime.Now - (DateTime)dataSavingManager.GetOtherValue("TimeStamp")).TotalSeconds;

            double blocksKilled;

            if (playerData.baseDamage >= blockHealth)
            {
                blocksKilled = secondsOffline / playerData.baseAttackSpeed;
            }
            else
            {
                double dps = (1 / playerData.baseAttackSpeed) * playerData.baseDamage;

                double totalDamage = secondsOffline * dps;
                blocksKilled = totalDamage / blockHealth;
            }

            double offlineReward = blocksKilled * blockKillReward * (double)dataSavingManager.GetOtherValue("OfflineMultiplier");

            Debug.LogWarning("seconds offline: " + secondsOffline);

            dataSavingManager.SetOtherValue("TimeStamp", DateTime.Now);
            dataSavingManager.Save();

            EventManager.TriggerEvent("OfflineProgress", offlineReward);
        }
        EventManager.TriggerEvent("BlockStatsUpdate", Tuple.Create(blockHealth, blockKillReward));
    }
Beispiel #2
0
    private void BlockKilled(object b)
    {
        Block deadBlock = (Block)b;
        double moneyEarned = deadBlock.killReward * playerMoneyMult;

        GameObject gText = Instantiate(goldText, deadBlock.transform.position, Quaternion.identity);
        gText.transform.GetChild(0).GetComponent<TextMeshPro>().SetText(NumberUtils.FormatLargeNumbers(moneyEarned));

        dataSavingManager.SetOtherValue("TotalMoneyEarned", (double)dataSavingManager.GetOtherValue("TotalMoneyEarned") + moneyEarned);
        dataSavingManager.Save();

        UpdatePlayerMoneyAndUI(moneyEarned + playerMoney);
        UpdatePendingPrestigeMoneyAndUI(deadBlock.killPrestigeReward);
    }
Beispiel #3
0
 public void PctSpawnSpeedUpgrade(double spawnSpeedMult)
 {
     blockSpawnData.spawnTime *= spawnSpeedMult;
     dataSavingManager.SetBlockSpawnData(blockSpawnData);
     dataSavingManager.Save();
 }
Beispiel #4
0
 private void SavePlayerData()
 {
     dataSavingManager.SetPlayerData(playerData);
     dataSavingManager.Save();
     EventManager.TriggerEvent("PlayerUpgraded");
 }