Exemplo n.º 1
0
    public void nextScene()
    {
        Inventory inven = GameObject.Find("inventorySystem").GetComponent <Inventory>();//현재 인벤토리 정보 가져옴
        gameInformationManager gameInformationManager = GameObject.Find("GameInformationManager").GetComponent <gameInformationManager>();


        for (int i = 0; i < 3; i++)
        {
            if (inven.slots[i].isEmpty == false) //퀵슬롯이 하나라도 차있으면
            {
                isQuickSlot = true;              //퀵슬롯에 아이템이 등록되어있다고 표ㅅ
                break;
            }
        }

        if (isQuickSlot == true)
        {
            // SceneManager.LoadScene("inventory");
            gameInformationManager.gotoNextScene();
        }

        else
        {
            Instantiate(cancelNext, GameObject.Find("CheckLocal").transform, false);//안내창 생cancelNext
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "claw")
        {
            //HP = HP - 5;

            gameInformationManager.player_HP -= 2;
        }
        else if (other.tag == "equip")
        {
            bgmPlayer.clip = bgmSounds[1].Clip;
            bgmPlayer.Play();
        }

        else if (other.tag == "heal_item")
        {
            bgmPlayer.clip = bgmSounds[1].Clip;
            bgmPlayer.Play();
            gameInformationManager.player_HP += 20;
            other.gameObject.SetActive(false);
        }
        else if (other.tag == "item")
        {
            bgmPlayer.clip = bgmSounds[1].Clip;
            bgmPlayer.Play();

            gameManager.GetComponent <tutorial1_GameManager>().gun_item++;
            other.gameObject.SetActive(false);
        }

        else if (other.tag == "portal")
        {
            other.GetComponent <BoxCollider>().enabled = false;
            gameInformationManager.isTime = false;
            gameInformationManager.gotoNextScene();
        }
        else if (other.tag == "trigger")
        {
            gameManager.GetComponent <tutorial1_GameManager>().ShowDialogue();
            other.gameObject.SetActive(false);
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) || OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
        {
            Debug.DrawRay(transform.position, transform.forward * MaxDistance, Color.blue, 0.3f);

            if (Physics.Raycast(transform.position, transform.forward, out hit, MaxDistance))
            {
                if (hit.collider.tag == "invenNext")
                {
                    manager.gotoNextScene();
                }
                if (hit.collider.tag == "QuickRegister")
                {
                    inven = hit.transform.gameObject.GetComponent <Slot_inventory>();
                    inven.selectItem();
                }
            }
        }
    }