Hey guys im trying to get this script to start mission two by identifying these enemies that will be throughout the scene this is what I have so far this script is in Java but the enemyAi (line 71) script is in C# and it wont identify it take a look… everything else works fine
enum GameState{ BeforeStart, Running, Finished }
enum MissionState{ One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Complete}
var activeSentries: int = 0;
var activeDemons : int = 0;
var gameState : GameState = GameState.BeforeStart;
var missionState : MissionState = MissionState.One;
function Update(){
if ( gameState == GameState.Running ) {
if ( activeSentries == 0 ) { // objective complete
gameState = GameState.Finished;
missionState = MissionState.Two;
}
}
}
function OnGUI(){
if (gameState == GameState.Finished ) { // only show this when the state is "Finished"
GUI.Box(Rect(Screen.width - 200, Screen.height - 275, 175, 125), "Mission Complete");
GUI.Label(Rect(Screen.width - 200, Screen.height - 250, 150, 125), " Click on Next Mission when ready ");
if ( GUI.Button(Rect(Screen.width - 180, Screen.height - 148, 125, 25), "Next Mission") ) {
// load next level here.
gameState = GameState.BeforeStart;
}
}
///////Mission One////////////
if (gameState == GameState.BeforeStart missionState == MissionState.One) { // only show this before the game actually starts
GUI.Box(Rect(Screen.width - 200, Screen.height - 275, 175, 125), "New Mission");
GUI.Label(Rect(Screen.width - 200, Screen.height - 250, 150, 125), " Destroy 10 Sentry Guns ");
if(GUI.Button(Rect(Screen.width - 180, Screen.height - 150, 125, 25), "Start Mission")){
//gameState = GameState.Running;
// find all sentries in the current level
var sentries : SentryGun[] = FindObjectsOfType(SentryGun) as SentryGun[]; // this assumes that your sentry gun script class is named "SentryGun"
for (var sentry: SentryGun in sentries) {
// enable it
sentry.enabled = true;
activeSentries ++; // and take note of the active sentries.
}
gameState = GameState.Running; // finally set game state to "Running". Now the update method will check the remaining sentries.
// when your sentry is destroyed, you need to decrease the activeSentries variable by one, that needs to be done elsewhere.
}
}
///////Mission Two////////////
if (gameState == GameState.BeforeStart missionState == MissionState.One) { // only show this before the game actually starts
GUI.Box(Rect(Screen.width - 200, Screen.height - 275, 175, 125), "New Mission");
GUI.Label(Rect(Screen.width - 200, Screen.height - 250, 150, 125), " Destroy 10 Sentry Guns ");
if(GUI.Button(Rect(Screen.width - 180, Screen.height - 150, 125, 25), "Start Mission")){
//gameState = GameState.Running;
// find all sentries in the current level
var demons : Demon[] = FindObjectsOfType(enemyAi) as Demon[]; // this assumes that your sentry gun script class is named "SentryGun"
for (var demon: Demon in demons) {
// enable it
demon.enabled = true;
activeDemons ++; // and take note of the active sentries.
}
gameState = GameState.Running; // finally set game state to "Running". Now the update method will check the remaining sentries.
// when your sentry is destroyed, you need to decrease the activeSentries variable by one, that needs to be done elsewhere.
}
}
}
can anyone help me out with this greatly appreciate it.
–RIO


