private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player" && Helper.distance(transform.position, collision.transform.position) < 1.3f) { audioSource.Play(); if (enemyController != null) { addPoints.Invoke(enemyController.enemiesCount); } SaveLoadDataController.LoadedData.playerLevel++; SaveLoadDataController.SaveData(); levelPassed.Invoke(); player.GetComponent <PlayerControler>().CanMove = false; } }
private void Die() { audioSource.clip = dieSound; audioSource.Play(); if (addPoints != null) { addPoints.Invoke(Mathf.CeilToInt(actualUnitStatistic.MaxHP / 2f)); } if (playerDied != null) { playerDied.Invoke(); SaveLoadDataController.ClearData(); } DropLoot(); dead = true; gameObject.SetActive(false); }
public void ResetGame() { SaveLoadDataController.ClearData(); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); }
private void OnDestroy() { SaveLoadDataController.SaveData(); }