示例#1
0
    void HandlePresetLerping(Prism.Utils.PrismPreset preset)
    {
        if (preset == null)
        {
            Debug.LogWarning("No preset found! Remember to set a Preset for each volume");
            return;
        }

        //If we need to lerp over time, lerp it
        if (instantSwitch == false && hasCompletedSwitch == false)
        {
            targetPRISM.LerpToPreset(preset, currentSwitchTime, isMainVolume);
            currentSwitchTime += Time.deltaTime;
            currentSwitchTime  = Mathf.Clamp01(currentSwitchTime);           // Mathf.Min(currentSwitchTime, 1f);

            if (currentSwitchTime == 1f)
            {
                hasCompletedSwitch = true;
                CallSetPrismPreset(preset);
            }
        }
    }
示例#2
0
    void GetTargetPRISM()
    {
        targetPRISM = targetCamera.GetComponent <PrismEffects>();

        if (targetPRISM == null)
        {
            Debug.LogWarning("Could not find a PRISM Effects script on your target/main camera!");
            return;
        }

        lastPreset = targetPRISM.currentPrismPreset;

        if (GetComponent <PrismEffects>() == targetPRISM && isMainVolume == false)
        {
#if UNITY_EDITOR
            //Debug.Log("Main volume set to: " + gameObject.name + ". All new PRISM Volumes will take initial settings from this volume.");
#endif
            volumeRange  = 1f;
            volumeSize   = new Vector3(1f, 1f, 1f);
            isMainVolume = true;
        }
    }
示例#3
0
    /// <summary>
    /// Triggers the volume.
    /// </summary>
    public void TriggerVolume()
    {
        //If PRISM is already being controlled by a volume, don't try to control it.
        if (targetPRISM.currentlyInsideVolume == true)
        {
            //Debug.Log("Prism script is already inside a volume - not triggering this one (" + gameObject.name + ")");
            return;
        }

        //Upon triggering a volume, we need to set the tether to active
        TetherVolume();
        isActiveVolume = true;
        lastPreset     = targetPRISM.currentPrismPreset;

        //The main volume should take the lowest priority of all. Hence, if we ARE the main volume, don't set this - it lets any other volume 'override' us
        if (isMainVolume == false)
        {
            targetPRISM.currentlyInsideVolume = true;
            //Debug.Log("Set to currently inside from " + gameObject.name);
        }

        if (lastPreset == null)
        {
            Debug.LogWarning("Could not find a PRISM.Preset on the target camera's PRISM component!");
        }

        //If we have the volume set to instant switch, switch the presets instantly
        if (instantSwitch)
        {
            CallSetPrismPreset(volumePreset);
        }
        else
        {
            //Otherwise, start this, which in Update() lerps the presets
            hasCompletedSwitch = false;
            currentSwitchTime  = 0f;
        }
    }
示例#4
0
 /// <summary>
 /// Sets the PRISM Preset on our linked PRISM script
 /// </summary>
 /// <param name="preset">Preset.</param>
 void CallSetPrismPreset(Prism.Utils.PrismPreset preset)
 {
     //Debug.Log("SET to " + preset.name + " from " + gameObject.name);
     targetPRISM.SetPrismPreset(preset);
 }