Пример #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (playerPassed)
        {
            return;
        }

        if (other.gameObject.CompareTag("Player"))
        {
            EventManager.OnPlatformPass?.Invoke();
            EventManager.OnPlayerScore?.Invoke(gameManager.HoleScoreIncrease);

            ScorePopUp popUp = Instantiate(addScorePopUp, transform.position, Quaternion.identity);
            popUp.InitializePopUp(gameManager.HoleScoreIncrease);
            playerPassed = true;
        }
    }
Пример #2
0
    private void HandleDestroy()
    {
        EventManager.OnPlayerScore?.Invoke(gameManager.EnemyScoreIncrease);
        EventManager.OnEnemyKill?.Invoke();

        CameraShake.Instance.TriggerShake();

        GameObject dead = Instantiate(deadEnemy, transform.parent.position, Quaternion.identity);

        dead.transform.parent = transform.parent.parent;

        ScorePopUp popUp = Instantiate(addScorePopUp, transform.position, Quaternion.identity);

        popUp.InitializePopUp(gameManager.EnemyScoreIncrease);

        SoundManager.Instance.PlaySound("EnemyDeath");

        Destroy(transform.parent.gameObject);
    }