コード例 #1
0
ファイル: Chatbox.cs プロジェクト: coconut1z/GDS1
 // Update is called once per frame
 void Update()
 {
     if (Global.bossMedley)
     {
         position = size;
     }
     if (InputKeys.isPressed(InputKeys.SHOOT))
     {
         position++;
         if (position < size)
         {
             UpdateText();
         }
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         {
             position = size;
             UpdateText();
         }
     }
     if (position >= size)
     {
         if (part % 2 == 0)
         {
             SetActiveText(chatTest.returnChatByPart(part + 1));
             stageManager.ChangeStage(gameObject, part / 2 + 1);
             gameObject.SetActive(false);
         }
         else
         {
             inventoryPanel.SetActive(true);
         }
     }
 }
コード例 #2
0
ファイル: Chatbox.cs プロジェクト: coconut1z/GDS1
 // Use this for initialization
 void Start()
 {
     nameText = transform.GetChild(1).GetComponent <Text> ();
     mainText = transform.GetChild(2).GetComponent <Text> ();
     chatTest = new ChatTest();
     SetActiveText(chatTest.returnChatByPart(1));
     stageManager = GameObject.Find("StageManager").GetComponent <StageManager>();
 }
コード例 #3
0
    private void OpenInventory()
    {
        GameObject[] goArray = SceneManager.GetSceneByName("Main").GetRootGameObjects();
        GameObject   canvas  = null;
        StageManager sm      = null;

        player.GetComponent <PlayerController>().canShoot = false;
        if (goArray.Length > 0)
        {
            for (int i = 0; i < goArray.Length; i++)
            {
                GameObject rootGo = goArray[i];
                if (rootGo.name.Equals("Canvas"))
                {
                    canvas  = rootGo;
                    chatbox = rootGo.transform.GetChild(4).GetComponent <Chatbox> ();
                }
                if (rootGo.tag == "EnemyBullet")
                {
                    Destroy(rootGo);
                }
                if (rootGo.name.Equals("StageManager"))
                {
                    sm = rootGo.GetComponent <StageManager> ();
                }
                if (rootGo.name.Equals("PlayerInventory"))
                {
                    rootGo.GetComponent <PlayerInventory> ().SortInventory();
                }
            }
        }

        if (chatPart != 0)
        {
            ChatTest c = new ChatTest();
            chatbox.gameObject.SetActive(true);
            chatbox.SetActiveText(c.returnChatByPart(chatPart));
            canvas.transform.GetChild(5).gameObject.GetComponent <InventoryPanel> ().PopulateList();
            canvas.transform.GetChild(5).gameObject.GetComponent <AbilityInventoryPanel> ().PopulateList();
            canvas.transform.GetChild(5).GetComponentInChildren <OKButton> ().position = nextPartName;
        }
        else
        {
            canvas.transform.GetChild(5).gameObject.SetActive(true);
            canvas.transform.GetChild(5).gameObject.GetComponent <InventoryPanel> ().PopulateList();
            canvas.transform.GetChild(5).gameObject.GetComponent <AbilityInventoryPanel> ().PopulateList();
            canvas.transform.GetChild(5).GetComponentInChildren <OKButton> ().position = nextPartName;
            if (!nextPartName.Equals("S1END") && !nextPartName.Equals("S2END") && !nextPartName.Equals("S3END") &&
                !nextPartName.Equals("S4END") && !nextPartName.Equals("S5END"))
            {
                sm.IncrementSafeScene();
            }
        }

        int sceneCount = SceneManager.sceneCount;

        for (int i = 0; i < sceneCount && sceneCount >= 3; i++)
        {
            Scene scene = SceneManager.GetSceneAt(i);
            if (scene.name != "Main" && scene.name != "S3AS")
            {
                SceneManager.UnloadSceneAsync(scene);
            }
        }

        SceneManager.UnloadSceneAsync(s);
    }