I am creating a simple game:
3 scenes, 3 character controllers, 3 enemies.
I have it set so that right Mouse click takes you to the next scene but you can only advance once the enemy in the scene has been destroyed.
It works fine for the first target but in the second scene I can freely move on without destroying the target.
It seems like there’s such a simple solution but I can’t quite see it.
I’m using JavaScript and using Raycast to destroy my enemies.
I’m quite new to Unity so sorry if I ask any follow up questions aha.
Any help would be great thanks:)
RClick_Enable Script:
#pragma strict
var canClick : boolean;
function Start()
{
canClick = false;
}
function Update()
{
if(RayCast_Target.objectDestroyed)
{
canClick = true;
}
if(canClick == true)
{
if((Input.GetMouseButtonDown(1)) && (Application.loadedLevel == (2)))
{
Debug.Log("Pressed right click.");
Application.LoadLevel(3);
}
if((Input.GetMouseButtonDown(1)) && (Application.loadedLevel == (2)))
{
Debug.Log("Pressed right click.");
Application.LoadLevel(3);
}
}
}