private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Surface")) { if (!winCondition) { OnTouchSurface?.Invoke(transform.position.x); OnUnderWater?.Invoke(false); canMove = false; } else { print("WIN"); OnWinning?.Invoke(); saveManagerScript.SaveFieldsIntoStatistic(); SceneManager.LoadScene("GameWinScene"); } } if (collision.CompareTag("Seaweed")) { OnCollisionWeed?.Invoke(); StartCoroutine(TouchSeaweedRoutine()); } if (collision.CompareTag("Pearl")) { OnPickUpPearl?.Invoke(); } if (collision.CompareTag("GigaPearl")) { OnPickUpGigaPearl?.Invoke(); winCondition = true; } if (collision.CompareTag("SpeedBuff")) { OnPickUpSpeedBuff?.Invoke(); StartCoroutine(PickUpSpeedBuff()); } if (collision.CompareTag("OxygenBuff")) { OnPickUpOxygenBuff?.Invoke(); } }
private void JumpInWater() { OnUnderWater?.Invoke(true); StartCoroutine(JumpRoutine()); }