Skip to content
Snippets Groups Projects
Commit ba027cba authored by Akmal Mahardika Nurwahyu Pratama's avatar Akmal Mahardika Nurwahyu Pratama
Browse files

fix: counted enemy kills

parent 9844ad62
1 merge request!35feat: fix Game Data
......@@ -18,7 +18,7 @@ namespace CompleteProject
CapsuleCollider capsuleCollider; // Reference to the capsule collider.
bool isDead; // Whether the enemy is dead.
bool isSinking; // Whether the enemy has started sinking through the floor.
public static int deathCount; // The amount of death count.
// public static int deathCount; // The amount of death count.
void Awake()
......@@ -34,7 +34,7 @@ namespace CompleteProject
currentHealth = startingHealth;
// reset death count
deathCount = 0;
// deathCount = 0;
}
......@@ -132,7 +132,9 @@ namespace CompleteProject
public void deathCountIncrement()
{
deathCount++;
int deathCount = PlayerPrefs.GetInt("DeathCount", 0);
PlayerPrefs.SetInt("DeathCount", deathCount + 1);
// deathCount++;
Debug.Log("EnemyHealth::deathCountIncrement deathCount: " + deathCount);
}
}
......
......@@ -21,6 +21,7 @@ public class MainMenu : MonoBehaviour
PlayerPrefs.SetInt(Statistics.MoneyCollected, 0);
PlayerPrefs.SetInt(Statistics.TotalScore, 0);
PlayerPrefs.SetInt(Statistics.OrbCollected, 0);
PlayerPrefs.SetInt("DeathCount", 0);
PlayerPrefs.Save();
}
......
......@@ -43,12 +43,12 @@ public class StatisticManager : MonoBehaviour
shootAccuracy = (shootAccuracy + accuracy) / 2;
distanceTravelled = distanceTravelled + playerMovement.GetDistanceTravelled();
playTime = playTime + sceneStopwatch.GetElapsedTime();
enemiesKilled = enemiesKilled + EnemyHealth.deathCount;
enemiesKilled = enemiesKilled + PlayerPrefs.GetInt("DeathCount", 0);
moneyCollected = moneyCollected + MoneyManager.money;
totalScore = totalScore + ScoreManager.score;
orbCollected = orbCollected + PlayerPrefs.GetInt("numDamageOrbPicked", 0) + PlayerPrefs.GetInt("numSpeedOrbPicked", 0) + PlayerPrefs.GetInt("numHealthOrbPicked", 0);
Debug.Log("StatisticManager::UpdateData() EnemyHealth.deathCount: " + EnemyHealth.deathCount);
Debug.Log("StatisticManager::UpdateData() EnemyHealth.deathCount: " + PlayerPrefs.GetInt("DeathCount", 0));
PlayerPrefs.SetFloat(Statistics.ShootAccuracy, shootAccuracy);
PlayerPrefs.SetFloat(Statistics.DistanceTravelled, distanceTravelled);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment