Hi
Me and my friends are making a small horror game in Unity. This is how it’s supposed to work.
The player begins in a scene called “tjhorror”. Once an objective here is completed, they can progress to the next scene, “House”. Another objective needs to be completed here before they can go on to the final scene, “basement”. From here on out, the player should be free to move back to the house and the “tjhorror” scene. This last thing doesn’t work.
Here’s the code we’re using to change scenes:
ChangeScene.cs
using UnityEngine;
using System.Collections;
public class ChangeScene : Collectibles
{
void OnTriggerEnter()
{
Debug.Log("Entered scene change cube.");
string currentLevel = Application.loadedLevelName;
if (!progressLocked)
{
switch (currentLevel)
{
case "tjhorror":
Application.LoadLevel("House");
Collectibles.collected = 0;
progressLocked = true;
break;
case "House":
Application.LoadLevel("Basement");
Collectibles.collected = 0;
progressLocked = true;
break;
case "Basement":
Application.LoadLevel("House");
break;
}
}
}
}
The last three lines of code are supposed to work so that the player returns to the “House” scene upon triggering an invisible cube placed above the stairs (see image).
Does anyone know what the issue is exactly? I have a feeling it’s something very easy but I’m failing to see it.