//--> Check if the puzzle is locked or not
    public void checkIfPuzzleIsAvailable()
    {
        if (checkIfNeededObjectAreInTheInventory() &&                 // Objects needed are available in the inventory
            callMethods.Call_A_Method_Only_Boolean(methodsList) &&    // all the custom method return true
            iconResetPuzzle &&
            !_actionsWhenPuzzleIsSolved.returnactionsWhenPuzzleIsSolved()
            ||
            ingameGlobalManager.instance._D)            // Debug Mode Activated
        {
            if (!b_OnlyFocus && !b_Generic)             // It is a puzzle
            {
                iconResetPuzzle.SetActive(true);

                if (iconPuzzleClue && objClueBox != null)
                {
                    iconPuzzleClue.SetActive(true);
                }
            }


            DeactivateObjectInTheInvenetoryViewer();
            b_PuzzleIsActivated = true;
        }
        else if ((!checkIfNeededObjectAreInTheInventory() ||               // Objects needed are not available in the inventory
                  !callMethods.Call_A_Method_Only_Boolean(methodsList)) && // A custom method return false
                 iconPuzzleNotAvailable &&
                 ingameGlobalManager.instance.b_focusModeIsActivated)
        {
            iconPuzzleNotAvailable.SetActive(true);                       // Activate an image to say that the puzzle is not available
            b_PuzzleIsActivated = false;


            //-> Display feedback info
            ingameGlobalManager gManager = ingameGlobalManager.instance;
            if (b_feedbackActivated && gManager.canvasPlayerInfos._infoUI)
            {
                bool b_Exist = false;
                for (var i = 0; i < gManager.canvasPlayerInfos._infoUI.listRefGameObject.Count; i++)
                {
                    if (gameObject == gManager.canvasPlayerInfos._infoUI.listRefGameObject[i])
                    {
                        b_Exist = true;
                    }
                }
                if (!b_Exist)
                {
                    gManager.canvasPlayerInfos._infoUI.playAnimInfo(gManager.currentFeedback.diaryList[gManager.currentLanguage]._languageSlot[feedbackIDList[0].ID].diaryTitle[0], "Feedback", gameObject);
                }
            }
        }

        if (!b_OnlyFocus && !b_Generic)
        {
            if (iconMobile_ExitPuzzle && !ingameGlobalManager.instance.b_DesktopInputs)
            {
                iconMobile_ExitPuzzle.SetActive(true);
            }
        }

        if (b_Generic)
        {
            //Debug.Log("Here");

            GetComponent <AP_Generic>().AP_Actions();
        }
    }
Esempio n. 2
0
//--> This function is called to rotate or translate an object
    public void MoveObject()
    {
        //-> Object is unlocked
        if (callMethods.Call_A_Method_Only_Boolean(methodsList) &&  // Check if all the custom methods return true
            checkIfGameobjectsInTheListAreActivated() &&            // check if needed object are activated in the scene
            checkNeededObjectsInTheInventory()                      // check if needed object is in the inventory
            ||
            ingameGlobalManager.instance._D                         // Debug Mode Activated
            )
        {
            DeactivateObjectInTheInvenetoryViewer();

            StopAllCoroutines();
            if (checkFocusMode() && camManager != null)                                         // Check if Focus Mode is activated

            {
                if (!ingameGlobalManager.instance.b_focusModeIsActivated)
                {
                    ingameGlobalManager.instance.FocusIsActivated(gameObject);

                    camManager.MoveCameraToFocusPosition(camManager.targetFocusCamera, true);
                }
                else
                {
                    camManager.MoveCameraToDefaultPosition();
                }
            }

            //-> Play one time Unlock options custom editor section 6
            if (!b_unlocked)
            {
                //-> Play Voice Over
                if (voiceOverManager && b_VoiceOverActivatedUnlocked && howManyTimeVoiceOverWasPlayed == 0)
                {
                    //Debug.Log ("Play Voice");
                    voiceOverManager.setupNewVoice(
                        ingameGlobalManager.instance.currentDiary,
                        ingameGlobalManager.instance.currentLanguage,
                        diaryIDListUnlock [0].ID,
                        ingameGlobalManager.instance.currentDiary.voiceOverDescription(
                            ingameGlobalManager.instance.currentLanguage,
                            diaryIDListUnlock [0].ID),
                        ingameGlobalManager.instance.currentDiary.r_audioPriority(
                            ingameGlobalManager.instance.currentLanguage,
                            diaryIDListUnlock [0].ID),
                        true);
                }

                //-> Display feedback
                if (info && b_feedbackActivatedUnlock)
                {
                    bool b_Exist = false;
                    for (var i = 0; i < info.listRefGameObject.Count; i++)
                    {
                        if (gameObject == info.listRefGameObject [i])
                        {
                            b_Exist = true;
                        }
                    }
                    if (!b_Exist)
                    {
                        info.playAnimInfo(ingameGlobalManager.instance.currentFeedback.diaryList [ingameGlobalManager.instance.currentLanguage]._languageSlot [feedbackIDListUnlock[0].ID].diaryTitle[0], "Feedback", gameObject);
                    }
                }

                //-> Play unLock sound Fx
                if (_audio && a_Unlocked)
                {
                    //Debug.Log ("Here");
                    audioVarious.prepareAudio(_audio, a_UnlockedVolume, .2f, a_Unlocked);   // Prepare Audio before playing sound
                    _audio.Play();
                }
                b_unlocked = true;
            }

            //-> Start Rotate object
            if (movementType == 0)
            {
                StartCoroutine(I_Rotate());
            }
            //-> Start translate
            if (movementType == 1)
            {
                StartCoroutine(I_Translate());
            }
        }
        //-> Object is locked
        else
        {
            //-> Display feedback
            if (info && b_feedbackActivated)
            {
                bool b_Exist = false;
                for (var i = 0; i < info.listRefGameObject.Count; i++)
                {
                    if (gameObject == info.listRefGameObject [i])
                    {
                        b_Exist = true;
                    }
                }
                if (!b_Exist)
                {
                    info.playAnimInfo(ingameGlobalManager.instance.currentFeedback.diaryList [ingameGlobalManager.instance.currentLanguage]._languageSlot [feedbackIDList[0].ID].diaryTitle[0], "Feedback", gameObject);
                }
            }
            //-> Play Voice Over
            if (voiceOverManager && b_VoiceOverActivated && howManyTimeVoiceOverWasPlayed == 0)
            {
                if (b_playVoiceOverOnlyOneTime)
                {
                    howManyTimeVoiceOverWasPlayed++;
                }

                voiceOverManager.setupNewVoice(
                    ingameGlobalManager.instance.currentDiary,
                    ingameGlobalManager.instance.currentLanguage,
                    diaryIDList[0].ID,
                    ingameGlobalManager.instance.currentDiary.voiceOverDescription(
                        ingameGlobalManager.instance.currentLanguage,
                        diaryIDList[0].ID),
                    ingameGlobalManager.instance.currentDiary.r_audioPriority(
                        ingameGlobalManager.instance.currentLanguage,
                        diaryIDList[0].ID),
                    true);
            }

            //-> Play Lock sound Fx
            if (_audio && a_Locked)
            {
                audioVarious.prepareAudio(_audio, a_LockedVolume, .2f, a_Locked);   // Prepare Audio before playing sound
                _audio.Play();
            }
        }
    }