void Awake()
    {
        if (!GlobalVars.MEDICAL_USE)
        {
            Destroy(gameObject);
        }
        else
        {
            //shows the gameobject
            Image myImage = gameObject.GetComponent <Image>();
            if (myImage != null)
            {
                myImage.enabled = true;
            }

            if (gameObject.name == "MedicalUI" && Application.loadedLevel == (int)GlobalVars.Scenes.Gathering)
            {
                //sets the zone indicator
                for (int i = 0; i < transform.childCount; i++)
                {
                    if (transform.GetChild(i).name == "ZoneIndicator")
                    {
                        SDKEventManager.SetIndicatorLight((zoneIndicator = transform.GetChild(i).GetComponent <Image>()));
                    }
                }
            }

            Text myText = gameObject.GetComponentInChildren <Text>();
            if (myText != null)
            {
                myText.enabled = true;
            }
            CollectionTimer.OnEndGame += HideIndicator;
        }
    }
	//singleton  implementation
	void Awake () {
		if (instance == null) {
			instance = this;
			DontDestroyOnLoad(gameObject);
		} else {
			Destroy(gameObject);
		}
	}
 //singleton  implementation
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
    //loads the SDK Settings menu
    public void loadSDKSettings()
    {
        //sends the event for a button press
        if (OnButtonPress != null)
        {
            OnButtonPress();
        }

        //shows the load screen
        Utility.ShowLoadScreen();

        SDKEventManager.LoadSDKScene();
    }
Ejemplo n.º 5
0
    //loads a new scene
    public void loadMode(string sceneName)
    {
        bool loadingAsync = false;

        if (OnButtonPress != null)
        {
            OnButtonPress();
        }

        if (CraftingTutorialController.TutorialActive)
        {
            Utility.Log("Trying to load scene asynchronoushly");
            StartCoroutine(LoadLevelAsync((int)GlobalVars.Scenes.Gathering));
            loadingAsync = true;
        }

        if (sceneName == GlobalVars.GATHERING_BUTTON_NAME)
        {
            if (!readyToEnterGathering)               //exits the loop if the user doesn't have four elements selected
            {
                return;
            }
            else
            {
                for (int i = 0; i < elementsInDropZones.Length; i++)                   //sets the elements for gathering
                {
                    PlayerPrefs.SetString("ELEMENT" + (i + 1).ToString(), elementsInDropZones[i]);
                }

                if (OnEnterGathering != null)
                {
                    OnEnterGathering(elementsInDropZones);
                }
            }
        }

        if (OnExitCrafting != null)
        {
            Utility.Log("Exiting the crafting mode event");
            OnExitCrafting();

            if (sceneName == GlobalVars.GATHERING_BUTTON_NAME && OnEnterScreen != null)
            {
                OnEnterScreen(GlobalVars.GATHERING_BUTTON_NAME);
            }
        }

        Utility.ShowLoadScreen();

        if (loadingAsync)
        {
            return;
        }

        if (sceneName == "Gathering")
        {
            Application.LoadLevel((int)GlobalVars.Scenes.Gathering);
        }
        else if (sceneName == "Wiki")
        {
            Application.LoadLevel((int)GlobalVars.Scenes.Wiki);
        }
        else if (sceneName == "Credits")
        {
            Application.LoadLevel((int)GlobalVars.Scenes.Credits);
        }
        else if (sceneName == "SDK" && GlobalVars.MEDICAL_USE)             //loads up the SDK settings
        {
            SDKEventManager.LoadSDKScene();
        }
    }