using UnityEngine;
using System.Collections;
using UnityEngine.UI;
//------------------------------------------------------------------------
//Perlin Noise Agents v1.0 - Data Preserve Class
//--Class controls the resetting process, flags and triggers are passed to the Controller once resetting is verified--Class is a component of the Data Preserve Empty Game Object--
//--Previous User Values are kept in the resetting process, we use the flag to recall spawn functions once we have killed off the agents
//Mode Lab - Written by Luis Quinones
//------------------------------------------------------------------------
public class DataPreserve : MonoBehaviour {
public Controller control;
public Button resetButton;
public bool restart { get; set; }
public bool fireUp;
void Start(){
resetButton.onClick.AddListener (delegate { //checks for the click on the reset button
restart = true;
if (restart) {
GameObject[] test = GameObject.FindGameObjectsWithTag ("AGENTDUDE");
foreach (GameObject t in test) {
Destroy(t); //Kill all agents
}
fireUp = true; //Set flags to be retreived by the controller
restart = false; //Set flags to be retreived by the controller
}
});
}
}
Update