Esempio n. 1
0
    // Use this for initialization
    public void Start( )
    {
        tempFadeAlpha         = fadeStartValue;
        tempFadeAlphaAddition = ((fadeEndValue - fadeStartValue) / ((2.0f / fadeSpeed) * 50.0f));

        WhichObjectIsThis();
        // check if common parameters
        if (isCommonParams)
        {
            fadeSpeed        = positionEffectSpeed = scaleEffectSpeed = rotationSpeed = commonSpeed;
            fadeDelay        = positionEffectDelay = scaleEffectDelay = rotationDelay = commonStartDelay;
            fadeDismissDelay = positionEffectDismissDelay = scaleEffectDismissDelay = rotationDismissDelay = commonDismissDelay;
            positionEaseType = scaleEaseType = rotationEaseType = commonEaseType;
            fadeLoopType     = positionLoopType = scaleLoopType = rotationLoopType = commonLoopType;
        }

        // check if random
        if (isRandom)
        {
            ApplyRandomEffects();
        }

        // get placeholder's alpha of input field.
        if (isInputField)
        {
            if (transform.childCount > 1)
            {
                Transform placeHold = transform.GetChild(transform.childCount - 2);
                inFieldPlaceAlphaDevider = 1.0f / (placeHold.GetComponent <Text>().color.a);
            }
        }

        // checking for random easetype of all objects
        if (isRandomPositionEaseType)
        {
            GetRandomEaseType("Position");
        }
        if (isRandomRotationEaseType)
        {
            GetRandomEaseType("Rotation");
        }
        if (isRandomScaleEaseType)
        {
            GetRandomEaseType("Scale");
        }

        if (isMoveFromBottom)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromLeft)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromRight)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromTop)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromTopRight)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromTopLeft)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromBottomRight)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isMoveFromBottomLeft)
        {
            GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", positionEaseType, "ignoretimescale", ignoreTimeScale, "looptype", positionLoopType));
        }
        if (isPopUp)
        {
            GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(popUpStartValue, popUpStartValue, popUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "easeType", scaleEaseType, "ignoretimescale", ignoreTimeScale, "looptype", scaleLoopType));
        }
        if (isReversePopUp)
        {
            GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(reversePopUpStartValue, reversePopUpStartValue, reversePopUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "easeType", scaleEaseType, "ignoretimescale", ignoreTimeScale, "looptype", scaleLoopType));
        }
        if (isRotation)
        {
            if (axisX)
            {
                rotationVector = new Vector3(flipsPerRotation, 0, 0);
            }
            else
            if (axisY)
            {
                rotationVector = new Vector3(0, flipsPerRotation, 0);
            }
            else
            if (axisZ)
            {
                rotationVector = new Vector3(0, 0, flipsPerRotation);
            }
            else
            {
                rotationVector = new Vector3(flipsPerRotation, flipsPerRotation, flipsPerRotation);
                Debug.LogError("You have not selected your axis to rotate in GUIEffects. Please select any one axis in the inspector on your GUI element.");
            }
            if (rotationLoopType == GUITween.LoopType.none)
            {
                if (isContinuosRotation)
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", rotationEaseType, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateContinuos"));
                }
                else
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", rotationEaseType, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateNonContinuos"));
                }
            }
            else
            {
                GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", rotationLoopType, "easeType", rotationEaseType, "ignoretimescale", ignoreTimeScale));
            }
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start( )
    {
        tempFadeAlpha         = fadeStartValue;
        tempFadeAlphaAddition = ((fadeEndValue - fadeStartValue) / ((2.0f / fadeSpeed) * 50.0f));

        WhichObjectIsThis();
        // check if common parameters
        if (isCommonParams)
        {
            fadeSpeed            = positionEffectSpeed = scaleEffectSpeed = rotationSpeed = commonSpeed;
            fadeDelay            = positionEffectDelay = scaleEffectDelay = rotationDelay = commonStartDelay;
            fadeDismissDelay     = positionEffectDismissDelay = scaleEffectDismissDelay = rotationDismissDelay = commonDismissDelay;
            isBounceBackPosition = isBounceBackScaleEffect = isBounceBackRotation = commonBounceBack;
        }

        // check if random
        if (isRandom)
        {
            ApplyRandomEffects();
        }

        if (isMoveFromBottom)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromLeft)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromRight)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromTop)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromTopRight)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromTopLeft)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y + Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromBottomRight)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x + Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isMoveFromBottomLeft)
        {
            if (isBounceBackPosition)
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.MoveFrom(gameObject, GUITween.Hash("position", new Vector3(gameObject.GetComponent <RectTransform>().localPosition.x - Screen.width, gameObject.GetComponent <RectTransform>().localPosition.y - Screen.height, gameObject.GetComponent <RectTransform>().localPosition.z), "islocal", true, "time", 2.0f / positionEffectSpeed, "delay", positionEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isPopUp)
        {
            if (isBounceBackScaleEffect)
            {
                GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(popUpStartValue, popUpStartValue, popUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(popUpStartValue, popUpStartValue, popUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isReversePopUp)
        {
            if (isBounceBackScaleEffect)
            {
                GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(reversePopUpStartValue, reversePopUpStartValue, reversePopUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale));
            }
            else
            {
                GUITween.ScaleFrom(gameObject, GUITween.Hash("scale", new Vector3(reversePopUpStartValue, reversePopUpStartValue, reversePopUpStartValue), "islocal", true, "time", 2.0f / scaleEffectSpeed, "delay", scaleEffectDelay, "ignoretimescale", ignoreTimeScale));
            }
        }
        if (isRotation)
        {
            if (axisX)
            {
                rotationVector = new Vector3(flipsPerRotation, 0, 0);
            }
            else
            if (axisY)
            {
                rotationVector = new Vector3(0, flipsPerRotation, 0);
            }
            else
            if (axisZ)
            {
                rotationVector = new Vector3(0, 0, flipsPerRotation);
            }
            else
            {
                rotationVector = new Vector3(flipsPerRotation, flipsPerRotation, flipsPerRotation);
                Debug.LogError("You have not selected your axis to rotate in GUIEffects. Please select any one axis in the inspector on your GUI element.");
            }
            if (isContinuosRotation)
            {
                if (isBounceBackRotation)
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateContinuos"));
                }
                else
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", GUITween.EaseType.linear, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateContinuos"));
                }
            }
            else
            {
                if (isBounceBackRotation)
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", GUITween.EaseType.spring, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateNonContinuos"));
                }
                else
                {
                    GUITween.RotateBy(gameObject, GUITween.Hash("amount", rotationVector, "time", 2.0f / rotationSpeed, "delay", rotationDelay, "looptype", GUITween.LoopType.none, "easeType", GUITween.EaseType.linear, "ignoretimescale", ignoreTimeScale, "oncomplete", "WaitAndRotateNonContinuos"));
                }
            }
        }
    }