// Start is called before the first frame update void Awake() { if (charac == null) { charac = GameObject.FindObjectOfType <CharactereMove>(); } }
void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { if (touched) { return; } if (other.gameObject.name.Contains("DetectionMine")) { CharactereMove characMove = other.GetComponentInParent <CharactereMove>(); characMove.Explosion(this.transform.position, meshFilts); //need to redraw the ground ! //move around the flower //DeactivateHimself(); touched = true; Invoke("UnTouched", 0.2f); } }
public void Start() { charac = GetComponentInParent <CharactereMove>(); }