My Collision Solution

I’ve been following along doing okay, I do have to read up on the Mathf Sin etc from the Oscillator as that melted my brain!


On my first try for this reset and level skip I come up with a solution first go with no additional reading required. I haven’t even looked at the lecturers solution yet I was that pumped.

Made the collision toggle visible in the inspector and set it to true by default.

[SerializeField] bool colOn = true;

In Update nested inside State.Alive I put the collision toggle and the levelskip functions.

if (Input.GetKey(KeyCode.L))
if (Input.GetKeyDown(KeyCode.C))
colOn = false;

Inside OnCollisionEnter inside default to abort the StartDeathSequence();

if (colOn == false)

If this the right way or most efficient? I doubt it. But it works and I’m pretty please with myself.

Privacy & Terms