コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (!conditionDummy && !haveChecked)
     {
         SkirmishStartSystem skir = FindObjectOfType <SkirmishStartSystem>();
         if (skir.GetDefeated() || skir.GetVictory())
         {
             conditionDummy = Instantiate(ConditionPrefab) as ConditionMenu;
             conditionDummy.GetConText().text = skir.GetVictory() ? "Victory!" : "Defeat!";
             VRPlayerIndicator player         = null;
             foreach (GameObject plays in GameObject.FindGameObjectsWithTag("Player"))
             {
                 VRPlayerIndicator ind = plays.GetComponent <VRPlayerIndicator>();
                 if (ind.GetPlayerNumber() == 1)
                 {
                     player = ind;
                 }
             }
             if (skir.GetVictory())
             {
                 Instantiate(victorySound, player.transform.position, player.transform.rotation);
             }
             else
             {
                 Instantiate(defeatSound, player.transform.position, player.transform.rotation);
             }
             haveChecked = true;
         }
     }
     else
     {
         if (timePassed >= 10)
         {
             SceneManager.LoadScene("MainMenu");
         }
         timePassed += Time.deltaTime;
         VRPlayerIndicator player = null;
         foreach (GameObject plays in GameObject.FindGameObjectsWithTag("Player"))
         {
             VRPlayerIndicator ind = plays.GetComponent <VRPlayerIndicator>();
             if (ind.GetPlayerNumber() == 1)
             {
                 player = ind;
             }
         }
         conditionDummy.transform.position = player.gameObject.transform.position + (player.transform.forward * 50) + (player.transform.up * 20);
     }
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        SkirmishStartSystem skir = FindObjectOfType <SkirmishStartSystem>();

        if (!skir)
        {
            if (((Input.GetButton("PrimaryStart") || Input.GetButton("SecondaryStart")) && !isButtonDown))
            {
                Debug.Log("Push Menu Button");
                isCalledMenu = !isCalledMenu;
                isButtonDown = true;
                buttonCool   = 1f;
            }
        }
        else
        {
            if (((Input.GetButton("PrimaryStart") || Input.GetButton("SecondaryStart")) && !isButtonDown) && (!skir.GetDefeated() && !skir.GetVictory()))
            {
                Debug.Log("Push Menu Button");
                isCalledMenu = !isCalledMenu;
                isButtonDown = true;
                buttonCool   = 1f;
            }
        }



        if (skir && (skir.GetVictory() || skir.GetDefeated()))
        {
            leftMenu.gameObject.SetActive(true);
            rightMenu.gameObject.SetActive(true);
            leftInGame.gameObject.SetActive(false);
            rightInGame.gameObject.SetActive(false);
            leftSuper.SetHandObj(leftMenu.gameObject);
            rightSuper.SetHandObj(rightMenu.gameObject);
            menuUI.SetActive(false);
        }
        else
        {
            leftMenu.gameObject.SetActive(isCalledMenu);
            rightMenu.gameObject.SetActive(isCalledMenu);

            leftInGame.gameObject.SetActive(!isCalledMenu);
            rightInGame.gameObject.SetActive(!isCalledMenu);

            menuUI.SetActive(isCalledMenu);

            if (isCalledMenu)
            {
                leftSuper.SetHandObj(leftMenu.gameObject);
                rightSuper.SetHandObj(rightMenu.gameObject);

                //menuUI.transform.LookAt(headNow.transform);
            }
            else
            {
                leftSuper.SetHandObj(leftInGame.gameObject);
                rightSuper.SetHandObj(rightInGame.gameObject);
            }
        }



        if (buttonCool > 0)
        {
            buttonCool -= Time.deltaTime;
        }
        else
        {
            isButtonDown = false;
        }
    }