i have made a script that is used to navigate levels, it works perfectly in unity, but when i build the project the script does not work! i can't seem to find the problem. could anybody tell me what is going on?
here is the code.
using UnityEngine;
using System.Collections;
public class Portal : MonoBehaviour {
public float number;
public bool hasEnoughChips;
public bool hasEnoughCodes;
public bool hasEnoughFloppys;
public bool Chip;
public bool Code;
public bool Flop;
public bool end;
public GameObject Player;
void Start () {
Player = GameObject.FindGameObjectWithTag ("pow");
}
void Update(){
float distance = Vector3.Distance(Player.transform.position, transform.position);
int cur_level = Application.loadedLevel;
if (Chip == true) {
if (Resources.control.Chip >= number) {
hasEnoughChips = true;
}
}
if (Code == true) {
if (Resources.control.Code >= number) {
hasEnoughCodes = true;
}
}
if (Flop == true) {
if (Resources.control.Flop >= number) {
hasEnoughFloppys = true;
}
}
if (distance<3){
if (Chip == true){
if(hasEnoughChips == true){
Application.LoadLevel(cur_level + 1);
}else{
Application.LoadLevel(0);
Resources.control.Save();
}
}
if (Code == true){
if(hasEnoughCodes == true){
Application.LoadLevel(cur_level + 1);
}else{
Application.LoadLevel(0);
Resources.control.Save();
}
}
if (Flop == true){
if(hasEnoughFloppys == true){
Application.LoadLevel(cur_level + 1);
}else{
Application.LoadLevel(0);
Resources.control.Save();
}
}
if (end == true){
Application.LoadLevel(0);
}
}
}
}
↧