Hi Artur,
I’m sorry for the late reply. I must have missed your thread but thanks to the bump bot I got another notification.
Did you already fix the problem?
I’ve just forked your project on GitHub and updated your project to Unity 2019.2.13f1 because I don’t have your version of Unity installed. There is no relevant difference between the versions anyways regarding this project, so updating should not cause any additional problems.
I created a new branch, so you hopefully will not get any conflicts if you already continued working on your project.
I’ve tested Level 1 and noticed that the ship is not shooting. The ActiveGuns method gets called, the bullet position printed but Bullets does not get enabled in the Inspector even though it is referenced correctly.
The reason for this is the GetButtonDown method which returns true only in the frame when the button was pressed down but not in the next frame.
A quick fix:
bool gunsActive = false;
void ProcessFiring()
{
if (Input.GetButton("Fire"))
{
if (!gunsActive) { ActivateGuns(); }
gunsActive = true;
}
else if (gunsActive)
{
DeactivateGuns();
gunsActive = false;
}
}
The particle system is not emitting the particles, not even in the editor when the game is not running.
I created a Shooting_Test scene. The enemy is exploding correctly when hit by a bullet. If you check the scene, do not apply the changes because it might be that I disabled a few things. The player is falling down due to the PlayerController script, so you will have to hurry up a bit.
I fixed a NullReferenceException in that scene which prevented the OnParticleCollision method from being executed correctly. If you wonder what the question mark is supposed to mean:
scoreBoard?.ScoreHit(scorePerHit);
// means
if (scoreBoard != null) { scoreBoard.ScoreHit(scorePerHit); }
It’s a feature that was introduced in C# 6.
The Explosion game object does get instantiated at the pivot point of the enemy but the mesh has got an offset.
The player shooting at the enemy:
The explosion:
Reset the origin / pivot point of your mesh in Blender (or whatever modelling software you use).
I sent you a pull request via GitHub so you can pull my commits if you want.