Would this approach be better?

    private void KillEnemy()
    {
        SpawnVFXatEnemyLocation(deathVFX);
        Destroy(gameObject);
    }

    private void SpawnVFXatEnemyLocation(GameObject currentVFX)
    {
        GameObject vfx = Instantiate(currentVFX, transform.position, Quaternion.identity);
        vfx.transform.parent = parent; 
    }

    private void ProcessHit()
    {
        SpawnVFXatEnemyLocation(hitVFX);
        hitPoints--;
        scoreBoard.IncreaseScore(scorePerHit);
    }
1 Like

Did it work properly?

Yes it did! :smiley:

Privacy & Terms