Пример #1
0
 /// <summary>
 /// Reset everything when the level finishes loading.
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="scenemode"></param>
 void OnLevelFinishedLoading(Scene scene, LoadSceneMode scenemode)
 {
     if (this != null && this.gameObject != null && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 0 && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 1 && SceneManager.GetActiveScene().buildIndex != 5 && SceneManager.GetActiveScene().buildIndex != 6)
     {
         if (GameObject.Find("CrossLevelVariables") != null)
         {
             crossvar = GameObject.Find("CrossLevelVariables").GetComponent <CrossLevelVariableHolder>();
         }
         if (crossvar.tutorial == true)
         {
             if (GameObject.Find("TutorialPanelHolder"))
             {
                 tutcontrol = GameObject.Find("TutorialPanelHolder").GetComponent <TutorialTextControlScript>();
             }
         }
         World = GameObject.Find("World");
         floor = GameObject.Find("Floor");
         if (floor)
         {
             floor.SetActive(false);
         }
         ontriggerenter = GetComponent <onTriggerEnterEnemy>();
         lineren        = gameObject.GetComponent <LineRenderer>();
         if (lineren == null)
         {
             lineren = gameObject.AddComponent <LineRenderer>();
         }
         lineren.startWidth = 0.01f;
         lineren.endWidth   = 0.01f;
         lineren.enabled    = false;
         lineren.material   = linemat;
     }
 }
Пример #2
0
    /// <summary>
    /// Reset everything when nessesitated by the level loading.
    /// </summary>
    /// <param name="scene"></param>
    /// <param name="scenemode"></param>
    void OnLevelFinishedLoading(Scene scene, LoadSceneMode scenemode)
    {
        if (this != null && this.gameObject != null)
        {
            selectedships.Clear();
            if (oculuscam != null && oculuscam.gameObject != null && oculuscam.GetActive() == true)
            {
                cameramain = oculuscam.GetComponent <Camera>();
            }
            if (Vivecam != null && Vivecam.gameObject != null && Vivecam.GetActive() == true)
            {
                cameramain = Vivecam.GetComponent <Camera>();
            }
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex == 0 || UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex == 1)
            {
                resetallpos();
            }
            else
            {
                GameObject.Find("VRTK_SDK").transform.localPosition = new Vector3(0, 0, 0);
            }

            if (this != null && this.gameObject != null && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 0 && UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex != 1 && SceneManager.GetActiveScene().buildIndex != 5 && SceneManager.GetActiveScene().buildIndex != 6)
            {
                GameObject varhold = GameObject.Find("CrossLevelVariables");
                if (varhold)
                {
                    crosslevelvarhol = GameObject.Find("CrossLevelVariables").GetComponent <CrossLevelVariableHolder>();
                }
                if (crosslevelvarhol.tutorial == true)
                {
                    if (GameObject.Find("TutorialPanelHolder"))
                    {
                        tutcontrol = GameObject.Find("TutorialPanelHolder").GetComponent <TutorialTextControlScript>();
                    }
                }

                unitcon    = GameObject.Find("Controllers").GetComponent <UnitMovementcommandcontroller>();
                photonview = GameObject.Find("JoinMultiplayer").GetComponent <PhotonView>();// establish tracking
                selectAll();
                lineren.enabled   = false;
                vrtkcontrolevents = GetComponent <VRTK_ControllerEvents>();
                team           = GameObject.Find("JoinMultiplayer").transform.parent.GetComponent <UnitMovementcommandcontroller>().team;
                ontriggerenter = GetComponent <onTriggerEnterEnemy>();
                tutorial       = GameObject.Find("TutorialPanelHolder");

                if (varhold && varhold.GetComponent <CrossLevelVariableHolder>().tutorial == false)
                {
                    tutorial.SetActive(false);
                    tutorial = null;
                }
                else
                {
                    tutorial.SetActive(true);
                }
            }
        }
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     bcol = this.GetComponent <BoxCollider>();
     vrtkcontrollerevents = GetComponent <VRTK_ControllerEvents>();
     StartCoroutine(Example());
     triggerCheck = GetComponent <onTriggerEnterEnemy>();
     vrtkcontrollerevents.TriggerClicked   += new ControllerInteractionEventHandler(triggerdownmeth);
     vrtkcontrollerevents.TriggerUnclicked += new ControllerInteractionEventHandler(triggerup);
 }