Ejemplo n.º 1
0
    private void CanPickUp()
    {
        if (pickupActivated)
        {
            if (hitInfo.transform != null)
            {
                if (hitInfo.transform.CompareTag("Item"))
                {
                    int hit_itemCode = hitInfo.transform.GetComponent <ItemPickUp>().item.itemCode;

                    // - 습득
                    if (hit_itemCode == 110) //퍼즐조각 일때
                    {
                        //Debug.Log(hitInfo.transform.GetComponent<ItemPickUp>().item.itemName + "획득했습니다");
                        Item hit_item = hitInfo.transform.GetComponent <ItemPickUp>().item;

                        //퍼즐조각 입수 사운드
                        SoundManger.instance.PlaySound(itemgainsound);


                        // - 퍼즐조각 수집 개수 증가
                        BlockCount++;
                        if (BlockCount == 1)
                        {
                            //guideController_script.change_sprite(1);
                            //guide_script.InStartFadeAnim();
                        }
                        else
                        {
                            guideController_script.change_sprite(3);
                            guide_script.InStartFadeAnim();
                        }

                        // - 퍼즐조각 습득
                        theInventory.AcquireItem(hit_item);

                        // - 외곽선 없애기
                        hitInfo.transform.gameObject.SetActive(false);
                        OutlineController.set_enabled(pre_ol_index, false);
                        //OutlineController.set_destroy(pre_ol_index); //필요없을수도

                        // - info 사라짐
                        InfoDisappear();
                    }

                    // - 사용
                    else if (hit_itemCode == 111) //조각 배치
                    {
                        if (theInventory.IsVoid_Slot(selectSlot_script.get_index()))
                        {
                            //// - 텍스트 출력
                            //puzzleText.text = "퍼즐조각이 필요하다";
                            ////페이드아웃
                            //text_script.InStartFadeAnim();

                            guideController_script.change_sprite(2);
                            guide_script.InStartFadeAnim();

                            return;
                        }

                        int select_itemCode = theInventory.get_ItemCode(selectSlot_script.get_index());

                        // - 퍼즐 배치
                        if (select_itemCode == 110)
                        {
                            //퍼즐조각 배치 사운드
                            SoundManger.instance.PlaySound(itemusesound);

                            //// - 텍스트 출력
                            //puzzleText.text = "퍼즐조각을 배치했다";
                            ////페이드아웃
                            //text_script.InStartFadeAnim();

                            guideController_script.change_sprite(4);
                            guide_script.InStartFadeAnim();

                            UseCount++;

                            // - 사용
                            Item selectItem = theInventory.get_ItemInfo(selectSlot_script.get_index());
                            theInventory.RemoveSlot(selectItem);
                            if (UseCount == 1)
                            {
                            }
                            else if (UseCount >= 5)
                            {
                                // - 퍼즐조각을 다 모았을때, 퍼즐 클릭가능한 상태가 된다
                                PuzzleOn = true;

                                // - info

                                // - 외곽선 , 빈퍼즐블럭 비활성화
                                hitInfo.transform.gameObject.SetActive(false);
                                OutlineController.set_enabled(pre_ol_index, false);
                                puzzleKey.gameObject.SetActive(true);
                            }
                        }
                        else
                        {
                            //// - 텍스트 출력
                            //puzzleText.text = "퍼즐조각이 필요하다";
                            ////페이드아웃
                            //text_script.InStartFadeAnim();

                            guideController_script.change_sprite(2);
                            guide_script.InStartFadeAnim();
                        }
                    }
                    else if (hit_itemCode == 112) //퍼즐 완
                    {
                        // - 카메라 이동
                        ChangeCam_script.change_Camera(1);

                        // - 스크립트 on
                        CarPuzzle_script.enabled = true;

                        // - info 없애기
                        InfoDisappear();
                        //text_script.stop_coroutine();
                        guide_script.stop_coroutine();
                    }
                    //if (hit_itemCode == 113) //상자 일때
                    //{
                    //    // - 콜라이더 비활성화
                    //    hitInfo.collider.enabled = false;

                    //    // - 외곽선 없애기
                    //    //hitInfo.transform.gameObject.SetActive(false);
                    //    OutlineController.set_enabled(pre_ol_index, false);

                    //    // - info 없애기
                    //    InfoDisappear();

                    //    // - 상자 애니메이션
                    //    boxOpen_script.set_aniBool();
                    //}

                    return;
                }
            }

            if (hitInfo.transform.CompareTag("Note_BP"))
            {
                // - 쪽지 상태
                hitInfo.transform.GetComponent <PageNote>().CheckAddcount(1);
                note_num_script.SetNoteCount();

                // - 팝업 상태
                popupNote = true;

                viewNote_script.StartAni_Note();

                InfoDisappear();
                OutlineController.set_enabled(pre_ol_index, false);

                return;
            }

            if (hitInfo.transform.CompareTag("ObjAni"))
            {
                //애니메이션 출력 전 이동
                InteractionMoving interactMoving_script = hitInfo.transform.GetComponent <InteractionMoving>();
                interactMoving_script.StartToMove();

                InfoDisappear();

                return;
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (stage == 2)
        {
            if (gameOver_script.SetClick == true)
            {
                return;
            }
        }

        //// - 커서 락모드 테스트
        //if (Input.GetKeyDown(KeyCode.T))
        //{
        //    Cursor.lockState = CursorLockMode.None;
        //}
        //if (Input.GetKeyDown(KeyCode.G))
        //{
        ////    Cursor.lockState = CursorLockMode.Locked;
        //}

        // - 옵션창
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            //Application.Quit();

            if (!pop) //옵션창이 튀어나왔을때, !pop -> kpop
            {
                OptionPopUp();
                if (notemager.guidePopup == true)
                {
                    notemager.NoClickEvent_fromGameMgr();
                }

                //커서
                //noneCursor();
                Cursor.lockState = CursorLockMode.None;
            }
            else
            {
                OptionDisappear();

                //커서
                //noneCursor();
                Cursor.lockState = CursorLockMode.Locked; //커서 고정
            }
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (!onceCaption)
            {
                onceCaption   = true;
                invenguide_on = false;
                guide_script.InStartFadeAnim();
            }

            if (check)
            {
                check = false;
                SlideInventory(false);
            }
            else
            {
                check = true;
                SlideInventory(true);
            }

            OnInventoryOpen(check);
        }

        //Move scroll
        if (check == true)
        {
            if (Input.GetAxis("Mouse ScrollWheel") > 0)
            {
                selectSlot_script.Set_slotPos_index(-1); //이동보간

                if (selectSlot_script.select_EndSlot)
                {
                    scrollRectView.anchoredPosition += new Vector2(0, -10);
                }
                //Debug.Log("위 실행");
            }
            if (Input.GetAxis("Mouse ScrollWheel") < 0)
            {
                selectSlot_script.Set_slotPos_index(1);

                if (selectSlot_script.select_EndSlot)
                {
                    scrollRectView.anchoredPosition += new Vector2(0, 10);
                }
                //Debug.Log("아래 실행");
            }
        }
    }