private static bool parseCameraFade(JSONAction a)
    {
        if (a.ints == null || a.ints.Length < 3)
        {
            Debug.LogWarning("Animator: CameraFade missing fade type, start or end targets.");
            return(false);
        }
        if (a.strings == null || a.strings.Length < 2 || a.colors == null || a.colors.Length < 2)
        {
            Debug.LogWarning("Animator: CameraFade missing start or end targets.");
            return(false);
        }
        Hashtable hash = new Hashtable();

        hash.Add("time", a.time);
        hash.Add("delay", a.delay);
        setupHashEase(hash, a);
        if (a.bools != null && a.bools.Length > 0)
        {
            hash.Add("reversed", a.bools[0]);
        }
        if (a.ints[1] == 0 || a.ints[2] == 0)
        {
            hash.Add("allcameras", allCameras);
        }
        if (a.stringsExtra != null && a.stringsExtra.Length > 0)
        {
            hash.Add("texture", AMTween.LoadTexture2D(a.stringsExtra[0]));
        }
        if (a.ints[1] == 0)
        {
            hash.Add("camera1", getGO(a.strings[0]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color1", a.colors[0].toColor());
        }
        if (a.ints[2] == 0)
        {
            hash.Add("camera2", getGO(a.strings[1]).GetComponent <Camera>());
        }
        else
        {
            hash.Add("color2", a.colors[1].toColor());
        }

        float[] parameters = a.floats;
        if (parameters == null)
        {
            parameters = new float[] {}
        }
        ;

        AMTween.CameraFade(a.ints[0], (a.bools == null || a.bools.Length < 2 ? false : a.bools[1]), parameters, hash);
        return(true);
    }
Esempio n. 2
0
    public void execute(int frameRate, float delay, Camera[] allCameras)
    {
        // if targets are equal do nothing
        if (endFrame == -1 || !hasTargets() || targetsAreEqual())
        {
            return;
        }
        float[]   parameters = cameraFadeParameters.ToArray();
        Hashtable hash       = new Hashtable();

        hash.Add("time", getTime(frameRate));
        hash.Add("delay", getWaitTime(frameRate, delay));
        if (easeType == 32)
        {
            hash.Add("easecurve", easeCurve);
        }
        else
        {
            hash.Add("easetype", (AMTween.EaseType)easeType);
        }
        hash.Add("reversed", AMTween.isTransitionReversed(cameraFadeType, parameters));
        hash.Add("allcameras", allCameras);
        if (startTargetType == 0)
        {
            hash.Add("camera1", startCamera);
        }
        else
        {
            hash.Add("color1", startColor);
        }
        if (endTargetType == 0)
        {
            hash.Add("camera2", endCamera);
        }
        else
        {
            hash.Add("color2", endColor);
        }
        if (AMCameraFade.needsTexture(cameraFadeType))
        {
            hash.Add("texture", irisShape);
        }
        AMTween.CameraFade(cameraFadeType, !still, parameters, hash);
    }