public override void Initialize(GameObject target)
    {
        // If the camera is unassigned, return
        if (camera == null)
        {
            return;
        }

        // Generate a random seed
        seed = Random.Range(0, 100000);

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = camera.gameObject.AddComponent <JuiceMono>();

        mono.module = this;
    }
    public override void Initialize(GameObject target)
    {
        // If particle prefab has not been assigned, return
        if (particles == null)
        {
            return;
        }

        // Reset the particle spawn count
        spawnCount = 0;

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = target.AddComponent <JuiceMono>();

        mono.module = this;
    }
Exemple #3
0
    public override void Initialize(GameObject target)
    {
        // If camera has null value, return
        if (camera == null)
        {
            return;
        }

        // Save the camera's original fov
        originalFov = camera.fieldOfView;

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = camera.gameObject.AddComponent <JuiceMono>();

        mono.module = this;
    }
    public override void Initialize(GameObject target)
    {
        // If an image has not been assigned, return
        if (image == null)
        {
            return;
        }

        // Save the original image color then initialize the image
        originalColor = image.color;
        image.color   = new Color(color.r, color.g, color.b, 0.0f);

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = image.gameObject.AddComponent <JuiceMono>();

        mono.module = this;
    }
    public override void Tick(JuiceMono mono)
    {
        // Update timer and evaluate the curve at this point
        timer += Time.deltaTime * speed;
        float c = Mathf.Clamp01(transition.Evaluate(timer));

        // Lerp the alpha value of the image based on the curve point
        image.color = Color.Lerp(new Color(color.r, color.g, color.b, 0.0f), color, c);

        // If timer has passed the effect's lifetime
        if (timer >= 1.0f)
        {
            // Reset the image color
            image.color = originalColor;

            // Flag the juice mono as complete
            mono.Complete = true;
        }
    }
    public override void Tick(JuiceMono mono)
    {
        // Update timer and evalate the curve at this point
        timer += Time.deltaTime * speed;
        float c = Mathf.Clamp01(transition.Evaluate(timer));

        // Set aberration intensity based on curve point
        chromaticAberration.intensity.Override(maxIntensity * c);

        // If timer has passed the effect's lifetime
        if (timer >= 1.0f)
        {
            // Remove the chromatic aberration settings
            chromaticAberration.enabled.Override(false);
            volume.profile.RemoveSettings <ChromaticAberration>();

            // Flag the juice mono as complete
            mono.Complete = true;
        }
    }
    public override void Initialize(GameObject target)
    {
        // If volume is unassigned, return
        if (volume == null)
        {
            return;
        }

        // Create the empty chromatic aberration settings and add them to the volume
        chromaticAberration = ScriptableObject.CreateInstance <ChromaticAberration>();
        chromaticAberration.enabled.Override(true);
        chromaticAberration.intensity.Override(0.0f);
        volume.profile.AddSettings(chromaticAberration);

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = volume.gameObject.AddComponent <JuiceMono>();

        mono.module = this;
    }
Exemple #8
0
    public override void Tick(JuiceMono mono)
    {
        // Increase the timer and evaluate the curve at this point
        timer += Time.deltaTime / duration;
        float c = Mathf.Clamp01(transition.Evaluate(timer));

        // Calculate the new FOV based on the distance
        float newFov = originalFov + c * distance;

        camera.fieldOfView = newFov;

        // If timer has passed the effect's lifetime
        if (timer >= 1.0f)
        {
            // Reset the camera's FOV
            camera.fieldOfView = originalFov;

            // Mark the juice mono as complete
            mono.Complete = true;
        }
    }
Exemple #9
0
    public override void Initialize(GameObject target)
    {
        // If the target has no rendererer, return
        renderer = target.GetComponent <Renderer>();
        if (renderer == null)
        {
            return;
        }

        // Create the property block to be used to alter the material color
        propertyBlock = new MaterialPropertyBlock();
        renderer.GetPropertyBlock(propertyBlock);

        // Get the original material color from the target renderer
        originalColor = renderer.sharedMaterial.color;

        // Reset timer and create the juice mono component
        timer = 0.0f;
        JuiceMono mono = target.AddComponent <JuiceMono>();

        mono.module = this;
    }
    public override void Tick(JuiceMono mono)
    {
        // Update timer
        timer += Time.deltaTime;

        // Get impact value based on curve (i2 = impact ^ 2)
        float i  = Mathf.Clamp01(impact * falloff.Evaluate(timer / duration));
        float i2 = i * i;

        // Rotation offset
        currentRotation.x = maxRotation.x * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed) * 2.0f - 1);
        currentRotation.y = maxRotation.y * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed + 1) * 2.0f - 1);
        currentRotation.z = maxRotation.z * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed + 2) * 2.0f - 1);

        // Translation offset
        currentPosition.x = maxTranslation.x * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed + 3) * 2.0f - 1);
        currentPosition.y = maxTranslation.y * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed + 4) * 2.0f - 1);
        currentPosition.z = maxTranslation.z * i2 * (Mathf.PerlinNoise(timer * noiseFrequency, seed + 5) * 2.0f - 1);

        // Camera Reset
        camera.transform.rotation  = Quaternion.Euler(camera.transform.rotation.eulerAngles.x - previousRotation.x, camera.transform.rotation.eulerAngles.y - previousRotation.y, camera.transform.rotation.eulerAngles.z - previousRotation.z);
        camera.transform.position -= previousPosition;

        // Completion check
        if (timer > duration)
        {
            mono.Complete = true;
            return;
        }

        // Apply new offsets
        camera.transform.rotation  = Quaternion.Euler(camera.transform.rotation.eulerAngles.x + currentRotation.x, camera.transform.rotation.eulerAngles.y + currentRotation.y, camera.transform.rotation.eulerAngles.z + previousRotation.z);
        camera.transform.position += currentPosition;

        // Save previous rotation
        previousRotation = currentRotation;
        previousPosition = currentPosition;
    }
Exemple #11
0
    public override void Tick(JuiceMono mono)
    {
        // Update the timer
        timer += Time.deltaTime;

        // Check if the timer has passed the spawn rate
        if (timer >= rate)
        {
            // Instantiate the particle prefab and increase the spawn count
            Object.Instantiate(particles, mono.transform.position, particles.transform.rotation);
            spawnCount++;

            // Check if the spawn count has reached the maximum amount
            if (spawnCount >= count)
            {
                // Flag the juice mono as complete
                mono.Complete = true;
                return;
            }

            // Decrement the timer
            timer -= rate;
        }
    }
Exemple #12
0
    public override void Tick(JuiceMono mono)
    {
        // Increase the timer and evaluate the curve at this point
        timer += Time.deltaTime * speed;
        float c = Mathf.Clamp01(transition.Evaluate(timer));

        // Interpolate color between the original and the target
        Color interpolatedColor = Color.Lerp(originalColor, color, c);

        // Set color value in the material property block and assign it to the renderer
        propertyBlock.SetColor("_Color", interpolatedColor);
        renderer.SetPropertyBlock(propertyBlock);

        // If timer has passed the effect's lifetime
        if (timer >= 1.0f)
        {
            // Clear the property block and remove it from the renderer
            propertyBlock.Clear();
            renderer.SetPropertyBlock(propertyBlock);

            // Flag the juice mono as complete
            mono.Complete = true;
        }
    }
Exemple #13
0
 /// <summary>
 /// Called once per frame by the Juice MonoBehaviour component.
 /// </summary>
 /// <param name="mono">The MonoBehaviour that called this function.</param>
 public abstract void Tick(JuiceMono mono);