can someone help me with a collect in order script which should reset a level if collected in the wrong order?,collect in order reset issue
I'm using this code to collect items in order but I'm missing a piece of code which resets the level if they are collected in the wrong order, can someone help me with this please.,I have a problem with my collect in order script, (see below)
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CollectInOrder : MonoBehaviour {
public float collectNumber;
public int collectLimit;
void OnTriggerEnter2D(Collider2D coll){
if (coll.gameObject.name == "Collect" + collectNumber) {
Destroy (coll.gameObject); // Destroys the GameObject which collided with this.
collectNumber++;
if (collectNumber >= collectLimit) {
Debug.Log ("Woo, you collected them all!");
ResetCollectNumber ();
}
}
}
public void ResetCollectNumber(){
collectNumber = 1;
}
}
This is what I have so far but my problem is that I'm missing a piece of code where the level would reset if you collect in the wrong order, hopefully someone can help me with this.
Your answer
Follow this Question
Related Questions
How to make certain collectibles have to be unlocked before being able to be picked up? 1 Answer
destroying a collected coin 2 Answers
How to make a GUI bar that counts items collected 0 Answers
Help with connecting different objects and disabling/enabling them, with sound effects 0 Answers
Collecting items 1 Answer