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 OnDestroy() { SaveLoadDataController.SaveData(); }