Trigger() public méthode

public Trigger ( ) : void
Résultat void
Exemple #1
0
    private void HandleButtons()
    {
        Settings.DrawLines     = UI.GetButtonActivated("Toggle Bulletlines");
        Settings.UseNormalGuns = UI.GetButtonActivated("Toggle Controller");

        if (UI.GetButtonActivated("Restart Scenario"))
        {
            Restart();
        }

        if (UI.GetButtonActivated("Mainmenu"))
        {
            ScenarioLogs.Clear();

            LevelLoader.levelName = "MainMenu";
            LevelLoader.Trigger();
            CurrentState = 0;
        }

        if (UI.GetButtonActivatedAndTurnOff("Next Scenario"))
        {
            NextStep();
        }
        if (UI.GetButtonActivatedAndTurnOff("Previous Scenario"))
        {
            PreviousStep();
        }

        if (UI.GetButtonActivatedAndTurnOff("Start_Scenario"))
        {
            Clear();

            States[CurrentState].OnStart();
        }
    }
    void OnTriggerEnter(Collider colliBall)
    {
        if (colliBall.gameObject.CompareTag("PlayArea"))          //check collider obj's tag
        {
            isPlayArea       = true;
            gameObject.layer = 10;
            //Debug.Log("ball inside play area " + isPlayArea);
        }

        if (colliBall.gameObject.CompareTag("Collectables"))
        {
            sumCollect = sumCollect + 1;
            SetGoalText();
            //Debug.Log("sum of collect = " + sumCollect);
        }

        if (colliBall.gameObject.CompareTag("Goal") && sumCollect >= collectTargets)
        {
            isGoal = true;
            SetGoalText();
        }


        if (colliBall.gameObject.CompareTag("Ground") && isGoal == false)
        {
            //isHitGround = true;
            if (!colliBall.GetComponent <AudioSource>().isPlaying)
            {
                colliBall.GetComponent <AudioSource>().Play();
            }
            resetLevel.Trigger();
            //Debug.Log("reset level");
        }
    }
Exemple #3
0
 private void OnTriggerEnter(Collider other)
 {
     if (unlocked && acceptableTags.Contains(other.gameObject.tag))
     {
         levelLoader.Trigger();
     }
 }
Exemple #4
0
    public void Load(string scene)
    {
        loadLevelScript.levelName = scene;

        loadLevelScript.Trigger();

        spectatorScreen.TriggerLoading(loadLevelScript.fadeInTime);
    }
Exemple #5
0
 void checkSuccess()
 {
     if (orbCount >= numOrbs)
     {
         levelCleared.Play();
         loadLevel.Trigger();
     }
 }
    public void ChangeScene(string sceneName)
    {
        ///Default LoadLevel///
        //SteamVR_LoadLevel.Begin(sceneName);

        ///Custom LoadLevel///
        loadLevel.levelName = sceneName;
        loadLevel.Trigger();
    }
Exemple #7
0
 private void HandleButtons()
 {
     if (UI.GetButtonActivated("MainMenu"))
     {
         ScenarioLogs.Clear();
         levelLoader.levelName = "MainMenu";
         levelLoader.Trigger();
     }
 }
Exemple #8
0
    public void Reset()
    {
        GM.numberOfCiviliansShot = 0;
        GM.numberOfEnemiesShot   = 0;
        GM.shotsFired            = 0;

        levelManager.levelName = levelName;
        levelManager.Trigger();
    }
Exemple #9
0
 /// <summary>
 /// VR切换场景
 /// </summary>
 /// <param name="SceneName">场景名字</param>
 public void LoadScenes(string SceneName)
 {
     try
     {
         SteamVR_LoadLevel level = GameObject.Find("[CLTOOLKIT]LoadScene").GetComponent <SteamVR_LoadLevel>();
         level.levelName = SceneName;
         level.Trigger();
     }
     catch (System.Exception) { throw; }
 }
Exemple #10
0
    // Fade to black and send the player back to the Overworld
    public void Die()
    {
        print("YOU DIED");
        SteamVR_LoadLevel loader = player.GetComponent <SteamVR_LoadLevel>();

        loader.levelName   = overworld;
        loader.fadeOutTime = fadeTime;
        loader.fadeInTime  = fadeTime;
        loader.Trigger();
    }
Exemple #11
0
 public void HitGoal()
 {
     if (collectCount == collectibles.Count)
     {
         loadLevel.Trigger();
     }
     else
     {
         Reset();
     }
 }
    void SetGoalText()
    {
        // Update the text field of score and targets
        winText.text   = "Collect Targets: " + collectTargets.ToString();       //set in inspector for different levels
        scoreText.text = "Score: " + sumCollect.ToString();

        if (isGoal)
        {
            // Set the text value of 'winText'
            winText.text = "Goal! You Win!";
            nextLevel.Trigger();             //load next level
        }
    }
    // Use this for initialization
    void Awake()
    {
#if UNITY_ANDROID
        m_camera      = Instantiate(m_CardBoardprefab);
        m_eventSystem = Instantiate(m_eventSystem);
        var mode = UnityEngine.SceneManagement.LoadSceneMode.Additive;
        UnityEngine.SceneManagement.SceneManager.LoadScene(levelname[levelnum], mode);
        DontDestroyOnLoad(m_eventSystem);
#elif UNITY_EDITOR_WIN
        m_camera      = Instantiate(m_CardBoardprefab);
        m_eventSystem = Instantiate(m_eventSystem);
        DontDestroyOnLoad(m_eventSystem);
        var mode = UnityEngine.SceneManagement.LoadSceneMode.Additive;
        //UnityEngine.SceneManagement.SceneManager.LoadScene(levelname[levelnum], mode);
#else
        m_camera = m_VRprefab;
        Instantiate(m_VRprefab);
        loadlevel.Trigger();
#endif
        DontDestroyOnLoad(m_camera);
        DontDestroyOnLoad(this);
        DontDestroyOnLoad(loadlevel);
    }
Exemple #14
0
    public void Submit()
    {
        Debug.Log("Submit pressed");

        GameManager GM = GameObject.Find("GameManager").GetComponent <GameManager>();

        GM.numberOfCivilians   = (int)civilianSlider.value;
        GM.numberOfEnemies     = (int)enemiesSlider.value;
        GM.hostility           = hostilityLevel;
        GM.intel               = typeOfIntel;
        GM.shotsFired          = 0;
        levelManager.levelName = levelName;
        levelManager.Trigger();
        GM.shotsFired = 0;
    }
Exemple #15
0
        void triggerYourLoad()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (loader == null)
            {
                return;
            }

            loader.Trigger();
        }
Exemple #16
0
    private void HandleButtons()
    {
        if (UI.GetButtonActivated("Exercise_2"))
        {
            ScenarioLogs.Clear();
            levelLoader.levelName = "Exercise_2_Scenario";
            levelLoader.Trigger();
        }

        Settings.UseNormalGuns = UI.GetButtonActivated("Toggle Controller");

        if (UI.GetButtonActivated("Exit Game"))
        {
            Application.Quit();
        }
    }
 void OnTriggerEnter(Collider colliBall)
 {
     if (colliBall.gameObject.CompareTag("Goal"))
     {
         sumOfGoal = sumOfGoal + 1;
         Debug.Log("sum of goal = " + sumOfGoal);
     }
     //colliPos = colliBall.GetComponent<Transform>().transform.position;  //get collider obj transform component and the position
     if (colliBall.gameObject.CompareTag("Ground"))
     {
         isHitGround = true;
         Destroy(gameObject);             //destory this ball object
         //Instantiate(gameObject,startTrans.transform.position, Quaternion.identity);//reset this ball object
         sumOfGoal = 0;
         resetLevel.Trigger();
     }
 }
Exemple #18
0
 void OnCollisionEnter(Collision ent)
 {
     if (ent.gameObject.CompareTag("Throwable") && ent.gameObject.layer == 10)
     {
         //if ((theGame.starsCollected == theGame.stars.Count) && (!gameController.isCheating))
         if ((theGame.starsCollected == theGame.stars.Count) && (!throwArea.isOut))
         {
             audioSource.Play();
             loadLevel.Trigger();
             restartCanvas.gameObject.SetActive(true);
         }
     }
     else if (ent.gameObject.CompareTag("Throwable") && ent.gameObject.layer == 9)
     {
         _ballReset.OnCollisionEnter(ent);
     }
 }
        void triggerYourLoad()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (loader == null)
            {
                return;
            }

            loader.levelName    = sceneName.Value;
            loader.loadAsync    = loadAsync.Value;
            loader.loadAdditive = loadAdditive.Value;
            loader.Trigger();
        }
Exemple #20
0
    void OnTriggerStay(Collider other)
    {
        if (!other.tag.Equals("GameController"))
        {
            return;
        }

        SteamVR_TrackedObject trackedObj = other.GetComponentInParent <SteamVR_TrackedObject>();

        SteamVR_Controller.Device device = SteamVR_Controller.Input((int)trackedObj.index);
        SteamVR_Controller.Input((int)trackedObj.index).TriggerHapticPulse(hapticStrength);

        if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
        {
            manager.GetComponent <AudioSource>().PlayOneShot(teleportClip);
            SteamVR_LoadLevel loader = player.GetComponent <SteamVR_LoadLevel>();
            loader.levelName   = sceneName;
            loader.fadeOutTime = fadeTime;
            loader.fadeInTime  = fadeTime;
            loader.Trigger();
        }
    }
Exemple #21
0
 void ShowTheLine()
 {
     timer += Time.deltaTime;
     if (timer < LineInterval / 3)
     {
         Fadein(Lines[LinesIndex]);
     }
     else if (timer > LineInterval * 2 / 3)
     {
         Fadeout(Lines[LinesIndex]);
     }
     if (timer > LineInterval)
     {
         LinesIndex++;
         if (LinesIndex > LinesNum - 1)
         {
             LinesIndex          = LinesNum - 1;
             loadLevel.levelName = "Beginning";
             loadLevel.Trigger();
             return;
         }
         timer = 0;
     }
 }
Exemple #22
0
 /// <summary>
 /// Loads end game scene
 /// </summary>
 /// <param name="result">What was the resulting end?</param>
 public void LoadPostScene(int result)
 {
     PlayerPrefs.SetInt("LastResult", result);
     loader.Trigger();
 }
Exemple #23
0
    void Update()
    {
        //for testing
        if (testing)
        {
            currentChapter = ChangeChapter;
            KillEnemyNum   = killEnemyNum;
            testing        = false;
        }
        else
        {
            ChangeChapter = currentChapter;
            killEnemyNum  = KillEnemyNum;
        }

        //Chapter01
        if (currentChapter == Chapter.Chapter1)
        {
            if (startbook.EventNowHappen)
            {
                UTCplayable01.Play();
                startbook.EventNowHappen = false;
            }
            if (GetHappyBall)
            {
                UTCplayable01.Resume();
            }
            else if (UTCplayable01.time > 12.42)
            {
                UTCplayable01.Pause();
                Happyball.SetActive(true);
            }

            if (UTCplayable01.time > 19.15)
            {
                UTCplayable01.Stop();
                UTC01.SetActive(false);
                currentChapter = Chapter.Chapter2;
            }
        }
        //Chapter02
        if (currentChapter == Chapter.Chapter2)
        {
            if (door.isOpen || door2.isOpen)
            {
                start02 = true;
            }

            if (!hasPlay)
            {
                if (start02)
                {
                    UTCplayable02.Play();
                    hasPlay = true;
                }
            }
            if (UTCplayable02.time > 8.8)
            {
                UTC02.SetActive(false);
                currentChapter = Chapter.Chapter3;
            }
        }
        //Chapter03
        if (currentChapter == Chapter.Chapter3)
        {
            if (!isChangeWeather2)
            {
                if (PrincessDoor.EventNowHappen || PrincessDoor2.EventNowHappen)
                {
                    changeSkybox.currentSkyBox = ChangeSkybox.skybox.Night;
                    changeSkybox.CheckCurrentSky();
                    isChangeWeather = true;
                }
            }
            if (!isChangeWeather)
            {
                if (player.transform.position.x > 3f && player.transform.position.z < -15f)
                {
                    changeSkybox.currentSkyBox = ChangeSkybox.skybox.Falling;
                    changeSkybox.CheckCurrentSky();
                    isChangeWeather = true;
                }
            }
            if (lamp.EventNowHappen)
            {
                PrincessDoor.isLock  = false;
                PrincessDoor2.isLock = false;
                UTCplayable03.Play();
                lamp.EventNowHappen = false;
                if (UTCObject.transform.localPosition != Vector3.zero)
                {
                    UTCObject.transform.localPosition = Vector3.zero;
                    UTCObject.transform.localRotation = Quaternion.Euler(0, 0, 0);
                }
                if (!isCp3Audio1Play)
                {
                    chapter3AudioSource.clip = chapter3AudioClips[0];
                    chapter3AudioSource.loop = false;
                    chapter3AudioSource.Play();
                    isCp3Audio1Play = true;
                    countTo2        = true;
                }
            }
            if (countTo2)
            {
                ToVoice2Timer += Time.deltaTime;
                if (ToVoice2Timer > 18.5f)
                {
                    if (!chapter3AudioSource.isPlaying)
                    {
                        chapter3AudioSource.clip = chapter3AudioClips[1];
                        chapter3AudioSource.loop = true;
                        chapter3AudioSource.Play();
                        countTo2 = false;
                    }
                }
            }
            if (NotCry)
            {
                if (!isNotCry)
                {
                    foreach (SkinnedMeshRenderer M in meshRenders)
                    {
                        M.material.shader = TransparentShader;
                    }
                    chapter3AudioSource.clip = chapter3AudioClips[2];
                    chapter3AudioSource.loop = true;
                    chapter3AudioSource.Play();
                    isNotCry = true;
                }
            }
            if (Disappear)
            {
                UTC03.SetActive(false);
                UTCplayable03.Stop();
                Elephant.GetComponent <Rigidbody>().isKinematic = false;
                fearBall.SetActive(true);
                Disappear = false;
                chapter3AudioSource.loop = false;
                chapter3AudioSource.Stop();
            }
            if (GetFearBall)
            {
                TimeLine4.SetActive(true);
                currentChapter = Chapter.Chapter4;
            }
        }
        //Chapter04
        if (currentChapter == Chapter.Chapter4)
        {
            if (player.transform.position.z > -13f)
            {
                if (!isVoice1Play)
                {
                    chapter4AudioSource.clip = chapter4AudioClips[0];
                    chapter4AudioSource.loop = false;
                    chapter4AudioSource.Play();
                    isVoice1Play       = true;
                    beginCountToVoice2 = true;
                }
            }
            if (beginCountToVoice2)
            {
                Cp4_ToVoice2Timer += Time.deltaTime;
                if (Cp4_ToVoice2Timer > 7)
                {
                    playerAudioSource.Play();
                    chapter4AudioSource.clip = chapter4AudioClips[1];
                    chapter4AudioSource.loop = true;
                    chapter4AudioSource.Play();
                    beginCountToVoice2 = false;
                }
            }
            if (GetAngryBall)
            {
                playerHealth.HP.gameObject.SetActive(true);
                if (!playerHealth.Alive)
                {
                    LoadLevel.levelName = "BadEnd";
                    LoadLevel.Trigger();
                }
                else
                {
                    if (KillEnemyNum == 5)
                    {
                        chapter4AudioSource.clip = chapter4AudioClips[2];
                        chapter4AudioSource.loop = false;
                        chapter4AudioSource.Play();
                        TimeLine4.SetActive(false);
                        TimeLine5.SetActive(true);
                        currentChapter = Chapter.Chapter5;
                    }
                }
            }
        }
        //Chapter05
        if (currentChapter == Chapter.Chapter5)
        {
            if (GetSadBall)
            {
                player.transform.position = new Vector3(-1f, 0, -10f);
                BlackWall.SetActive(true);
                emotionSys.IndexIsLock = true;
            }
            if (Vector3.Angle(Head.transform.forward, BlackWall.transform.forward) < 60 && Vector3.Angle(rightHand.transform.forward, BlackWall.transform.forward) < 60 && SpotLighting.activeInHierarchy)
            {
                if (!hasPlayed)
                {
                    Lastvideo.Play();
                    chapter5AudioSource.Play();
                    hasPlayed = true;
                }
            }
            if (Lastvideo.isPlaying)
            {
                if (Lastvideo.time > 22.4f)
                {
                    BlackWall.SetActive(false);
                    player.transform.position = new Vector3(-1f, 0, -11f);
                    TimeLine6.SetActive(true);
                    emotionSys.IndexIsLock = false;
                    emotionSys.InitBalls();
                    emotionSys.IndexIsLock = true;
                    currentChapter         = Chapter.Chapter6;
                }
            }
        }
        //Chapter06
        if (currentChapter == Chapter.Chapter6)
        {
            if (GetLastBall)
            {
                combine.Combine = true;
                CombineTimer   += Time.deltaTime;
                if (CombineTimer > 15.0f)
                {
                    if (CheckTrueEndCondition())
                    {
                        //player.transform.position = new Vector3(-1.5f, 0, -11f);
                        iTween.MoveTo(player, new Vector3(-1.5f, 0, -11f), 3.0f);
                        TimeLine6.SetActive(false);
                        TimeLine7.SetActive(true);
                        currentChapter = Chapter.Chapter7;
                    }
                    else
                    {
                        LoadLevel.levelName = "NormalEnd";
                        LoadLevel.Trigger();
                    }
                }
            }
        }
        //Chapter07
        if (currentChapter == Chapter.Chapter7)
        {
            if (!TrueEndhasplayed)
            {
                iTween.MoveTo(player, new Vector3(1.5f, 0, -11f), 2.0f);
                trueEnd.Play();
                TrueEndhasplayed = true;
            }
            trueEndTimer += Time.deltaTime;
            if (trueEndTimer > 27)
            {
                LoadLevel.levelName = "TrueEnd";
                LoadLevel.Trigger();
            }
        }
    }
 public void RestartGame()
 {
     loadLevel.Trigger();
 }
Exemple #25
0
 public void Restart()
 {
     levelLoader.Trigger();
 }
Exemple #26
0
 public void OnCollisionEnter()
 {
     loadLevel.Trigger();
 }
Exemple #27
0
 public void Changelevel()
 {
     loadlevel.Trigger();
 }
 void GoToNextLevel()
 {
     Debug.Log("Load Next Level");
     loadLevel.Trigger();
 }
Exemple #29
0
 private void Update()
 {
     if (Begin)
     {
         TimeLine += Time.deltaTime;
         Fadeout(StartButon);
         if (TimeLine > 1.5f && TimeLine < 1.5f + FadeTime)
         {
             StartButon.gameObject.SetActive(false);
             Fadein(Line1);
         }
         if (TimeLine > 2.7f && TimeLine < 2.7f + FadeTime)
         {
             Fadein(Line2);
         }
         if (TimeLine > 7.0f && TimeLine < 7.0f + FadeTime)
         {
             Fadeout(Line1);
             Fadeout(Line2);
         }
         if (TimeLine > 8.2f && TimeLine < 8.2f + FadeTime)
         {
             Fadein(Line3);
         }
         if (TimeLine > 9.4f && TimeLine < 9.4f + FadeTime)
         {
             Fadein(Line4);
         }
         if (TimeLine > 11.0f)
         {
             Begin = false;
         }
     }
     if (Question)
     {
         TimeLine += Time.deltaTime;
         Fadeout(Line3);
         Fadeout(Line4);
         if (TimeLine > 12.2f && TimeLine < 12.2f + FadeTime)
         {
             Line4.gameObject.SetActive(false);
             Fadein(Line5);
         }
         if (TimeLine > 13.5f && TimeLine < 13.5f + FadeTime)
         {
             Fadein(Line6);
         }
         if (TimeLine > 19.7f && TimeLine < 19.7f + FadeTime)
         {
             Fadeout(Line5);
             Fadeout(Line6);
         }
         if (TimeLine > 21.0f && TimeLine < 21.0f + FadeTime)
         {
             Fadein(Line7);
         }
         if (TimeLine > 22.2f && TimeLine < 22.2f + FadeTime)
         {
             Fadeout(Line7);
         }
         if (TimeLine > 27.0f)
         {
             Question = false;
             loadLevel.Trigger();
         }
     }
 }
Exemple #30
0
 public void GameWin()
 {
     gameWinCanvas.SetActive(true);
     StartCoroutine(WaitS());
     loadLevel.Trigger();
 }