Esempio n. 1
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();
            }
        }
    }