private void OnTriggerEnter(Collider other) { if (other.CompareTag("Research")) { if (!isResearching && !other.GetComponent <MonumentLevel>().waitingForSacrifice) { startMovement = false; GetComponent <NavMeshAgent>().enabled = false; GetComponent <NavMeshObstacle>().enabled = false; GetComponent <Collider>().enabled = false; healthFill.transform.parent.gameObject.SetActive(false); //this sets the health bar bg inactive. //Destroy(GetComponent<Collider>()); monument = other.GetComponent <MonumentLevel>(); monument.unitsResearchingMe.Add(this); isResearching = true; } else if (other.GetComponent <MonumentLevel>().waitingForSacrifice&& !waitingToBeSacd) { Destroy(gameObject); } } if (other.CompareTag("MaxResearch")) { DeathStuff();//this will grant bolts on death, which //might be fine since you maxed out research and it's //time to end the game. } }
public void CheckAndSpawnAResearcher() { MonumentLevel currentM = null; foreach (GameObject ml in monumentLevels) { if (ml.GetComponent <BoxCollider>().enabled) { currentM = ml.GetComponent <MonumentLevel>(); //print("current research = " + currentM.name); } } if (currentM.unitsResearchingMe.Count == 0) { StartCoroutine(ObjectsManager.instance.SpawnEnemy(ObjectsManager.instance.boardsInplay[1], 2, myPaths[3], 3, 1, 3)); //print("there's nobody researching ahhh"); } }