示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.transform.CompareTag("Wall"))
        {
            timeover.gameObject.SetActive(true);
            StartCoroutine(Title());


            cellar_.MoveStop();
        }
    }
    //
    private void Check_use_Item()
    {
        if (hitInfo2.transform != null)
        {
            if (hitInfo2.transform.CompareTag("Location")) //compare @
            {
                // - 클릭한 장식장 위치의 스크립트 얻기
                DisplayLocation location_script = hitInfo2.transform.GetComponent <DisplayLocation>();

                if (PickUp_state)
                {
                    //인형 배치 사운드
                    SoundManger.instance.PlaySound(itemgainsound);

                    // 장식장 인형 가질수있으면 가져가기
                    location_script.take_Doll();
                    PickUp_state = false;

                    // #
                    //if (!enter_3stage)
                    displayManager_script.count--;
                }
                else
                {
                    // - 선택슬롯의 인덱스 얻기
                    int use_index = selectSlot_script.get_index();

                    if (!theInventory.IsVoid_Slot(use_index)) //슬롯에 아이템이 있는가? 있으면 IsVoid_Slot반환값이 false
                    {
                        if (location_script.tryToPut_doll())  //장식장 위치에 이미 인형이 있는가? 없으면 true
                        {
                            //인형 배치 사운드
                            SoundManger.instance.PlaySound(itemgainsound);

                            // - 아이템 활성화

                            // 아이템 코드
                            int doll_itemCode = theInventory.get_ItemCode(use_index);
                            // 장식장 놓을때, 이동
                            int doll_displayIndex = displayManager_script.compareItemCode(doll_itemCode); //인형매니저(2배치퍼즐)에서 아이템 인덱스 얻기
                            displayManager_script.MoveSelectedInputArry(
                                doll_displayIndex,
                                location_script.get_DisplayPosition(),
                                location_script.get_DisplayRotation());
                            location_script.lay_Doll();

                            // - 장식장 비교를 위한 변수

                            // 장식장 위치 넘버
                            int display_index = location_script.location_Num;

                            // - 아이템 코드 저장 #
                            displayManager_script.set_DisplayArry(display_index, doll_itemCode);

                            // - 아이템사용 후, 슬롯 클리어  O
                            theInventory.clear_Slot(use_index);

                            // - count 증가 #
                            displayManager_script.count++;

                            // - 2스테이지 장식장 배치가 3스테이지로 옮겨짐. 한번만 실행 # (2스테이지 클리어)
                            if (displayManager_script.count == 8)
                            {
                                //2스테이지 배치퍼즐 off
                                displayManager_script.enabled = false;
                                displayManager_script.destroy_colliders();

                                //3스테이지 배치퍼즐 on
                                displayManager_script2.enabled = true;
                                displayManager_script2.init_inputArry(displayManager_script.get_inputArry());
                                displayManager_script2.Create_sameOne();

                                //라이트
                                _lightOn_script.LightOn();

                                //3스테이지 카메라 스크립트 on
                                actionController_3stage_script.enabled = true;

                                enter_3stage = true;

                                //손전등 없어지기 - 손전등 관련 스크립트 가져오기
                                //FlashlightItem.SetActive(false);
                                flash_end.FlashLightEnd(1);

                                //지하실, 2층계단 오픈
                                //tempDoor.SetActive(false); //콜라이더 비활성화
                                //tempStairs.SetActive(false);
                                temp_basement.SetActive(false);

                                // 지하실 열리기(임시) _________
                                //DoorOpen_Basement doorAni = tempStairs.GetComponent<DoorOpen_Basement>();
                                //doorAni.StartDoorAni();
                                lookingBasement_script.enabled = true;

                                //지하실 파티클 오픈
                                Ring_Particle.SetActive(true);

                                //지하실 움직임 끝
                                _cellarManager.MoveStop();

                                //지하실 엿보기 기능 끝
                                //_cellarDoor_script.enabled = false; //트리거로 검사해서 소용 없다
                                _cellarDoor_script.Set2StageEnd();

                                //모닥불
                                Fire_script.FireWallStartSound();

                                if (particleRing.isPlaying)
                                {
                                    particleRing.Play();
                                }

                                //웬디 AI on
                                wendyAI_Script.ClearLayoutPuzzle();
                                wendyAI_Script.colliderChange();

                                // 외곽선 해제
                                if (pre_ol_index != -1)
                                {
                                    //외곽선 해제
                                    OutlineController.set_enabled(pre_ol_index, false);
                                    pre_ol_index = -1;
                                    OutlineController.set_check(false);
                                    outline_active = false;

                                    // - 클릭버튼 해제
                                    actionCaption.SetActive(false);
                                }
                            }
                        }
                    }
                }
            }
        }
        else
        {
            PickUp_state = false;
        }
    }