So, basically what I’m trying to do is write a bit of code that checks if all my objectives are complete, and if so, load a scene that says you’ve won.
My current mission checker is working fine, so when kill all enemies, mission A being complete returns true, but what I want to do is check if every mission is complete, so that’s A, B, C, etc, all returning true, and then doing something when that happens.
This is the code that checks if each mission’s requirements are met, and returns true if so. I just don’t know where to go next…
using UnityEngine;
using System.Collections;
public class Objectives : MonoBehaviour
{
public gameObjectives[] MissionList;
int objectiveDone = 0;
void Update()
{
//Debug.Log (MissionList.Length);
for (int i = 0; i < MissionList.Length; i++)
{
int missionsDone = 0;
for (int j = 0; j < MissionList*.objectiveObject.GetComponentsInChildren<EnemyBuilding>().Length; j++)*
-
{*
_ if(MissionList*.objectiveObject.GetComponentsInChildren()[j].done)_
_ {_
_ missionsDone++;_
_ }*_
_ if(missionsDone == MissionList*.objectiveObject.GetComponentsInChildren().Length)
{
//Debug.Log("FINISHED OBJECTIVE " + i);*_
_ MissionList*.isComplete = true;
}
}
}
}
}*_