Ejemplo n.º 1
0
    private void LaunchRotateProperty(EMMotionProperties properties, bool useCurrentState, bool reverse)
    {
        Vector3 start = startTransform.rotation;
        Vector3 end   = properties.transform.rotation;
        float   delay = 0;

        if (reverse)
        {
            start = end;
            end   = startTransform.rotation;
        }


        if (useCurrentState)
        {
            start = cachedTransform.localRotation.eulerAngles;
        }
        else
        {
            delay = properties.rotateEasing.delay;
        }

        EMEasing.ValueTo(gameObject, motionId, properties.rotateEasing.easeType, start, end, properties.rotateEasing.time, delay, "On_StartMotion", "On_RotateUI", "On_EndMotion");

        cachedTransform.localRotation = Quaternion.Euler(start);
    }
Ejemplo n.º 2
0
    private void LaunchScaleProperty(EMMotionProperties properties, bool useCurrentState, bool reverse)
    {
        Vector3 start = startTransform.scale;
        Vector3 end   = properties.transform.scale;
        float   delay = 0;

        if (reverse)
        {
            start = end;
            end   = startTransform.scale;
        }

        if (useCurrentState)
        {
            start = cachedTransform.localScale;
        }
        else
        {
            delay = properties.scaleEasing.delay;
        }

        EMEasing.ValueTo(gameObject, motionId, properties.scaleEasing.easeType, start, end, properties.scaleEasing.time, delay, "On_StartMotion", "On_ScaleUI", "On_EndMotion");

        cachedTransform.localScale = start;
    }
Ejemplo n.º 3
0
    private void LaunchAlphaProperty(EMMotionProperties properties, bool useCurrentState, bool reverse)
    {
        float start = startTransform.alpha;
        float end   = properties.transform.alpha;
        float delay = 0;

        if (reverse)
        {
            start = end;
            end   = startTransform.alpha;
        }

        if (useCurrentState)
        {
            start = cachedCanvasGroup.alpha;
        }
        else
        {
            delay = properties.alphaEasing.delay;
        }

        EMEasing.ValueTo(gameObject, motionId, properties.alphaEasing.easeType, start, end, properties.alphaEasing.time, delay, "On_StartMotion", "On_AlphaUI", "On_EndMotion");

        cachedCanvasGroup.alpha = start;
    }
Ejemplo n.º 4
0
    private void LaunchMoveProperty(EMMotionProperties properties, bool useCurrentState, bool reverse)
    {
        EMTransform transform = GetTransformFromProperties(properties, useCurrentState);

        Vector3 start = Vector3.zero;
        Vector3 end   = Vector3.zero;
        float   delay = 0;

        if (!useCurrentState)
        {
            delay = properties.moveEasing.delay;
        }

        if (reverse)
        {
            start = transform.position;
            end   = startTransform.position;

            if (useCurrentState)
            {
                start = cachedTransform.anchoredPosition;
            }

            if (properties.moveDirection == EMMotionProperties.MotionDirection.UserDefined && !useCurrentState)
            {
                start = GetPosition2NewAnchor(start, transform.anchorMin, startTransform.anchorMin);
                cachedTransform.anchorMin = startTransform.anchorMin;
                cachedTransform.anchorMax = startTransform.anchorMax;
            }
            else if (useCurrentState)
            {
                start = GetPosition2NewAnchor(start, cachedTransform.anchorMin, startTransform.anchorMin);

                cachedTransform.anchorMin = startTransform.anchorMin;
                cachedTransform.anchorMax = startTransform.anchorMax;
            }
        }
        else
        {
            start = startTransform.position;
            end   = transform.position;

            if (useCurrentState)
            {
                start = cachedTransform.anchoredPosition;
            }

            if (cachedTransform.anchorMin != properties.transform.anchorMin && properties.moveDirection == EMMotionProperties.MotionDirection.UserDefined)
            {
                start = GetPosition2NewAnchor(start, cachedTransform.anchorMin, properties.transform.anchorMin);
                cachedTransform.anchorMin = properties.transform.anchorMin;
                cachedTransform.anchorMax = properties.transform.anchorMax;
            }
        }


        EMEasing.ValueTo(gameObject, motionId, properties.moveEasing.easeType, start, end, properties.moveEasing.time, delay, "On_StartMotion", "On_MoveUI", "On_EndMotion");
        cachedTransform.anchoredPosition = start;
    }
Ejemplo n.º 5
0
 public EMOpenCloseMotion()
 {
     motionState    = MotionState.Closed;
     OpenAtStart    = true;
     isShuttingDown = false;
     openProp       = new EMMotionProperties(EMMotionProperties.MotionType.Open);
     closeProp      = new EMMotionProperties(EMMotionProperties.MotionType.Close);
 }
Ejemplo n.º 6
0
    void UserDefinedStartPosition(EMMotionProperties motion, RectTransform rect, ref bool inRec)
    {
        if (!inRec)
        {
            GUI.backgroundColor = Color.green;
        }
        else
        {
            GUI.backgroundColor = Color.red;
        }

        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(20);
        string label = "Record";

        if (inRec)
        {
            label = "Stop record";
        }
        if (GUILayout.Button(label, GUILayout.Width(100)))
        {
            if (!inRec)
            {
                startRect.InitPositionFromRectTransform(rect);
                motion.transform.ApplyPositionToRectTransform(rect);
            }
            else
            {
                EndRecord(motion, rect);
            }
            inRec = !inRec;
        }
        GUI.backgroundColor = Color.white;

        if (inRec)
        {
            EditorGUILayout.Vector3Field("", rect.anchoredPosition);
        }
        else
        {
            EditorGUILayout.Vector3Field("", motion.transform.position);
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
    }
Ejemplo n.º 7
0
    protected void LaunchMotionSequence(EMMotionProperties properties, bool useCurrentState, bool reverse)
    {
        currentPropertiesCounter = 0;
        propertiesCounter        = 0;

        currentProp = properties;

        // Move
        if (properties.isMove)
        {
            LaunchMoveProperty(properties, useCurrentState, reverse);
            propertiesCounter++;
        }

        // Rotate
        if (properties.isRotate)
        {
            LaunchRotateProperty(properties, useCurrentState, reverse);
            propertiesCounter++;
        }

        // Scale
        if (properties.isScale)
        {
            LaunchScaleProperty(properties, useCurrentState, reverse);
            propertiesCounter++;
        }

        if (properties.isAlpha)
        {
            LaunchAlphaProperty(properties, useCurrentState, reverse);
            propertiesCounter++;
        }

        // No Effect
        if (propertiesCounter == 0)
        {
            On_StartMotion(motionId);
            On_EndMotion(motionId);
        }
    }
Ejemplo n.º 8
0
	protected void LaunchMotionSequence(EMMotionProperties properties,bool useCurrentState,bool reverse){
		
		currentPropertiesCounter =0;
		propertiesCounter=0;

		currentProp = properties;
		
		// Move
		if (properties.isMove){
			LaunchMoveProperty( properties,useCurrentState, reverse );
			propertiesCounter++;
		}

		// Rotate
		if (properties.isRotate){
			LaunchRotateProperty( properties,useCurrentState,reverse);
			propertiesCounter++;
		}

		// Scale
		if (properties.isScale){
			LaunchScaleProperty(  properties,useCurrentState,reverse);
			propertiesCounter++;
		}

		if (properties.isAlpha){
			LaunchAlphaProperty(  properties,useCurrentState,reverse);
			propertiesCounter++;
		}

		// No Effect
		if (propertiesCounter ==0){
			On_StartMotion(motionId);
			On_EndMotion(motionId);
		}

	}
Ejemplo n.º 9
0
	void EndRecord(EMMotionProperties motion,RectTransform rect){

		startRect.ApplyAllToRectTransform( rect, rect.GetComponentInParent<CanvasGroup>() );
	}
	void UserDefinedStartPosition(EMMotionProperties motion, RectTransform rect, ref bool inRec){

		if (!inRec)
			GUI.backgroundColor = Color.green;
		else
			GUI.backgroundColor = Color.red;

		EditorGUILayout.BeginHorizontal();
		GUILayout.Space(20);
		string label="Record";
		if (inRec) label ="Stop record";
		if (GUILayout.Button(label, GUILayout.Width(100))){
			if (!inRec){
				startRect.InitPositionFromRectTransform( rect );
				motion.transform.ApplyPositionToRectTransform( rect);
			}
			else{
				EndRecord( motion,rect);
			}
			inRec = !inRec;
		}
		GUI.backgroundColor = Color.white;

		if (inRec)
			EditorGUILayout.Vector3Field( "",rect.anchoredPosition);
		else{
			EditorGUILayout.Vector3Field("", motion.transform.position);
		}
		EditorGUILayout.EndHorizontal();

		EditorGUILayout.Space();
	}
Ejemplo n.º 11
0
    protected EMTransform GetTransformFromProperties(EMMotionProperties prop, bool useCurrent)
    {
        EMTransform transform = new EMTransform();

        if (prop.isMove)
        {
            if (prop.moveDirection != EMMotionProperties.MotionDirection.UserDefined)
            {
                transform.anchorMin = startTransform.anchorMin;
                transform.anchorMax = startTransform.anchorMax;

                Vector3 scale = startTransform.scale;
                if (useCurrent)
                {
                    scale = cachedTransform.localScale;
                }
                if (prop.isScale)
                {
                    scale = prop.transform.scale;
                }

                if (useCurrent)
                {
                    transform.position = ComputePosition(cachedTransform.anchoredPosition, prop.moveDirection, scale, prop.isInside);
                }
                else
                {
                    transform.position = ComputePosition(startTransform.position, prop.moveDirection, scale, prop.isInside);
                }
            }
            else
            {
                transform.anchorMin = prop.transform.anchorMin;
                transform.anchorMax = prop.transform.anchorMax;
                transform.position  = prop.transform.position;
            }
        }
        else
        {
            transform.position  = startTransform.position;
            transform.anchorMin = startTransform.anchorMin;
            transform.anchorMax = startTransform.anchorMax;
        }

        if (prop.isRotate)
        {
            transform.rotation = prop.transform.rotation;
        }
        else
        {
            transform.rotation = startTransform.rotation;
        }

        if (prop.isScale)
        {
            transform.scale = prop.transform.scale;
        }
        else
        {
            transform.scale = startTransform.scale;
        }

        if (prop.isAlpha)
        {
            transform.alpha = prop.transform.alpha;
        }
        else
        {
            transform.alpha = startTransform.alpha;
        }

        return(transform);
    }
	private void UIEffectInspector( EMMotionProperties motion, RectTransform rect, ref bool inRec){

		motion.sound = (AudioClip)EditorGUILayout.ObjectField("Sound",motion.sound,typeof(AudioClip),false);
		motion.volume = EditorGUILayout.Slider("Volume",motion.volume,0f,1f);
		
		EditorGUILayout.Space();
		
		if (motion.motionType == EMMotionProperties.MotionType.Open){
			motion.autoClose = EMGuiTools.Toggle("Auto close",motion.autoClose,true);
			if (motion.autoClose){
				EditorGUI.indentLevel++;
				motion.autoCloseDelayTime = EditorGUILayout.FloatField("After (in second)",motion.autoCloseDelayTime);
				EditorGUI.indentLevel--;
			}
		}
		
		EditorGUILayout.Space();
		
		#region Move
		EditorGUI.indentLevel++;
		EditorGUILayout.BeginHorizontal ();
		GUILayout.Space(5);
		motion.inspectorShowMove = EMGuiTools.BeginFoldOut( "Move effect",motion.inspectorShowMove);
		EditorGUILayout.EndHorizontal();
		if (motion.inspectorShowMove){
			EMGuiTools.BeginGroup(6);{
				motion.isMove = EMGuiTools.Toggle("Enable move effect",motion.isMove,true);
				if (motion.isMove){
					
					string label = "From";
					if (motion.motionType == EMMotionProperties.MotionType.Close){
						label = "To";
					}
					motion.moveDirection = (EMMotionProperties.MotionDirection)EditorGUILayout.EnumPopup(label,motion.moveDirection);
					if (motion.moveDirection == EMMotionProperties.MotionDirection.UserDefined){
						UserDefinedStartPosition( motion, rect, ref inRec );
					}
					UIEaseInspector( motion.moveEasing);
				}
			}EMGuiTools.EndGroup();
			
		}
		else{
			EditorGUILayout.Space();
		}
		EditorGUI.indentLevel--;
		#endregion

		#region Rotate
		EditorGUI.indentLevel++;
		EditorGUILayout.BeginHorizontal ();
		GUILayout.Space(5);
		motion.inspectorShowRotate = EMGuiTools.BeginFoldOut( "Rotation effect",motion.inspectorShowRotate);
		EditorGUILayout.EndHorizontal();
		if (motion.inspectorShowRotate){
			EMGuiTools.BeginGroup(6);{
				motion.isRotate = EMGuiTools.Toggle("Enable rotation effect",motion.isRotate,true);
				if (motion.isRotate){	
					motion.transform.rotation = EditorGUILayout.Vector3Field("Rotation",motion.transform.rotation);
					UIEaseInspector( motion.rotateEasing);
				}
			}EMGuiTools.EndGroup();
			
		}
		else{
			EditorGUILayout.Space();
		}
		EditorGUI.indentLevel--;
		#endregion

		#region Scale
		EditorGUI.indentLevel++;
		EditorGUILayout.BeginHorizontal ();
		GUILayout.Space(5);
		motion.inspectorShowScale = EMGuiTools.BeginFoldOut( "Scale effect",motion.inspectorShowScale);
		EditorGUILayout.EndHorizontal();
		if (motion.inspectorShowScale){
			EMGuiTools.BeginGroup(6);{
				motion.isScale = EMGuiTools.Toggle("Enable scale effect",motion.isScale,true);
				if (motion.isScale){
					motion.transform.scale = EditorGUILayout.Vector3Field("Scale",motion.transform.scale);
					UIEaseInspector( motion.scaleEasing);
				}
			}EMGuiTools.EndGroup();
			
		}
		else{
			EditorGUILayout.Space();
		}
		EditorGUI.indentLevel--;
		#endregion

		#region Alpha
		EditorGUI.indentLevel++;
		EditorGUILayout.BeginHorizontal ();
		GUILayout.Space(5);
		motion.inspectorShowColor = EMGuiTools.BeginFoldOut( "alpha effect",motion.inspectorShowColor);
		EditorGUILayout.EndHorizontal();
		if (motion.inspectorShowColor){
			EMGuiTools.BeginGroup(6);{
				motion.isAlpha = EMGuiTools.Toggle("Enable alpha effect",motion.isAlpha,true);
				if (motion.isAlpha){
					motion.transform.alpha = EditorGUILayout.Slider("Alpha",motion.transform.alpha,0f,1f);
					UIEaseInspector( motion.alphaEasing);
				}
			}EMGuiTools.EndGroup();
		}
		else{
			EditorGUILayout.Space();
		}
		EditorGUI.indentLevel--;
		#endregion
	}
	void EndRecord(EMMotionProperties motion,RectTransform rect){
		motion.transform.InitPositionFromRectTransform( rect );
		startRect.ApplyPositionToRectTransform( rect);

	}
Ejemplo n.º 14
0
	private void LaunchMoveProperty( EMMotionProperties properties, bool useCurrentState,bool reverse){

		EMTransform transform = GetTransformFromProperties( properties,useCurrentState);

		Vector3 start = Vector3.zero;
		Vector3 end = Vector3.zero;
		float delay = 0;

		if (!useCurrentState) delay = properties.moveEasing.delay;

		if (reverse){
			start = transform.position;
			end = startTransform.position;

			if (useCurrentState) start= cachedTransform.anchoredPosition;

			if (properties.moveDirection == EMMotionProperties.MotionDirection.UserDefined && !useCurrentState){
				start = GetPosition2NewAnchor( start,transform.anchorMin,startTransform.anchorMin );
				cachedTransform.anchorMin = startTransform.anchorMin;
				cachedTransform.anchorMax = startTransform.anchorMax;
			}
			else if ( useCurrentState){
				start = GetPosition2NewAnchor( start,cachedTransform.anchorMin,startTransform.anchorMin );

				cachedTransform.anchorMin = startTransform.anchorMin;
				cachedTransform.anchorMax = startTransform.anchorMax;
			}


		}
		else{

			start = startTransform.position;
			end = transform.position;

			if (useCurrentState) start = cachedTransform.anchoredPosition;

			if (cachedTransform.anchorMin != properties.transform.anchorMin && properties.moveDirection == EMMotionProperties.MotionDirection.UserDefined){
				start = GetPosition2NewAnchor( start,cachedTransform.anchorMin,properties.transform.anchorMin );
				cachedTransform.anchorMin = properties.transform.anchorMin;
				cachedTransform.anchorMax = properties.transform.anchorMax;
			}
		}


		EMEasing.ValueTo( gameObject, motionId, properties.moveEasing.easeType, start, end, properties.moveEasing.time,delay,"On_StartMotion","On_MoveUI","On_EndMotion");
		cachedTransform.anchoredPosition = start;

	}
Ejemplo n.º 15
0
 public EMSimpleMotion()
 {
     isShuttingDown  = false;
     simpleProp      = new EMMotionProperties(EMMotionProperties.MotionType.OneShot);
     playSoundRewind = false;
 }
Ejemplo n.º 16
0
 void EndRecord(EMMotionProperties motion, RectTransform rect)
 {
     startRect.ApplyAllToRectTransform(rect, rect.GetComponentInParent <CanvasGroup>());
 }
Ejemplo n.º 17
0
    private void MotionInspector(EMSimpleMotion simpleMotion)
    {
        Record(simpleMotion);

        EMMotionProperties motion = simpleMotion.simpleProp;

        #region Move
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowMove = EMGuiTools.BeginFoldOut("Move effect", motion.inspectorShowMove);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowMove)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isMove = EMGuiTools.Toggle("Enable move effect", motion.isMove, true);
                if (motion.isMove)
                {
                    motion.moveDirection = (EMMotionProperties.MotionDirection)EditorGUILayout.EnumPopup("To", motion.moveDirection);
                    if (motion.moveDirection == EMMotionProperties.MotionDirection.UserDefined)
                    {
                        if (inRec)
                        {
                            motion.transform.position  = simpleMotion.rectTransform().anchoredPosition;
                            motion.transform.anchorMin = simpleMotion.rectTransform().anchorMin;
                            motion.transform.anchorMax = simpleMotion.rectTransform().anchorMax;
                        }
                        EditorGUILayout.Vector3Field("Position", motion.transform.position);
                    }
                    UIEaseInspector(motion.moveEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Rotate
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowRotate = EMGuiTools.BeginFoldOut("Rotation effect", motion.inspectorShowRotate);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowRotate)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isRotate = EMGuiTools.Toggle("Enable rotation effect", motion.isRotate, true);
                if (motion.isRotate)
                {
                    if (inRec)
                    {
                        motion.transform.rotation = simpleMotion.rectTransform().localRotation.eulerAngles;
                    }
                    motion.transform.rotation = EditorGUILayout.Vector3Field("Rotation", motion.transform.rotation);
                    UIEaseInspector(motion.rotateEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Scale
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowScale = EMGuiTools.BeginFoldOut("Scale effect", motion.inspectorShowScale);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowScale)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isScale = EMGuiTools.Toggle("Enable scale effect", motion.isScale, true);
                if (motion.isScale)
                {
                    if (inRec)
                    {
                        motion.transform.scale = simpleMotion.rectTransform().localScale;
                    }
                    motion.transform.scale = EditorGUILayout.Vector3Field("Scale", motion.transform.scale);
                    UIEaseInspector(motion.scaleEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Alpha
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowColor = EMGuiTools.BeginFoldOut("alpha effect", motion.inspectorShowColor);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowColor)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isAlpha = EMGuiTools.Toggle("Enable alpha effect", motion.isAlpha, true);
                if (motion.isAlpha)
                {
                    if (inRec)
                    {
                        simpleMotion.rectTransform().GetComponentInParent <CanvasGroup>().alpha = motion.transform.alpha;
                    }
                    motion.transform.alpha = EditorGUILayout.Slider("Alpha", motion.transform.alpha, 0f, 1f);
                    UIEaseInspector(motion.alphaEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion
    }
Ejemplo n.º 18
0
 void EndRecord(EMMotionProperties motion, RectTransform rect)
 {
     motion.transform.InitPositionFromRectTransform(rect);
     startRect.ApplyPositionToRectTransform(rect);
 }
Ejemplo n.º 19
0
    private void UIEffectInspector(EMMotionProperties motion, RectTransform rect, ref bool inRec)
    {
        motion.sound  = (AudioClip)EditorGUILayout.ObjectField("Sound", motion.sound, typeof(AudioClip), false);
        motion.volume = EditorGUILayout.Slider("Volume", motion.volume, 0f, 1f);

        EditorGUILayout.Space();

        if (motion.motionType == EMMotionProperties.MotionType.Open)
        {
            motion.autoClose = EMGuiTools.Toggle("Auto close", motion.autoClose, true);
            if (motion.autoClose)
            {
                EditorGUI.indentLevel++;
                motion.autoCloseDelayTime = EditorGUILayout.FloatField("After (in second)", motion.autoCloseDelayTime);
                EditorGUI.indentLevel--;
            }
        }

        EditorGUILayout.Space();

        #region Move
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowMove = EMGuiTools.BeginFoldOut("Move effect", motion.inspectorShowMove);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowMove)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isMove = EMGuiTools.Toggle("Enable move effect", motion.isMove, true);
                if (motion.isMove)
                {
                    string label = "From";
                    if (motion.motionType == EMMotionProperties.MotionType.Close)
                    {
                        label = "To";
                    }
                    motion.moveDirection = (EMMotionProperties.MotionDirection)EditorGUILayout.EnumPopup(label, motion.moveDirection);
                    if (motion.moveDirection == EMMotionProperties.MotionDirection.UserDefined)
                    {
                        UserDefinedStartPosition(motion, rect, ref inRec);
                    }
                    UIEaseInspector(motion.moveEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Rotate
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowRotate = EMGuiTools.BeginFoldOut("Rotation effect", motion.inspectorShowRotate);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowRotate)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isRotate = EMGuiTools.Toggle("Enable rotation effect", motion.isRotate, true);
                if (motion.isRotate)
                {
                    motion.transform.rotation = EditorGUILayout.Vector3Field("Rotation", motion.transform.rotation);
                    UIEaseInspector(motion.rotateEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Scale
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowScale = EMGuiTools.BeginFoldOut("Scale effect", motion.inspectorShowScale);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowScale)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isScale = EMGuiTools.Toggle("Enable scale effect", motion.isScale, true);
                if (motion.isScale)
                {
                    motion.transform.scale = EditorGUILayout.Vector3Field("Scale", motion.transform.scale);
                    UIEaseInspector(motion.scaleEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion

        #region Alpha
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        motion.inspectorShowColor = EMGuiTools.BeginFoldOut("alpha effect", motion.inspectorShowColor);
        EditorGUILayout.EndHorizontal();
        if (motion.inspectorShowColor)
        {
            EMGuiTools.BeginGroup(6); {
                motion.isAlpha = EMGuiTools.Toggle("Enable alpha effect", motion.isAlpha, true);
                if (motion.isAlpha)
                {
                    motion.transform.alpha = EditorGUILayout.Slider("Alpha", motion.transform.alpha, 0f, 1f);
                    UIEaseInspector(motion.alphaEasing);
                }
            } EMGuiTools.EndGroup();
        }
        else
        {
            EditorGUILayout.Space();
        }
        EditorGUI.indentLevel--;
        #endregion
    }
Ejemplo n.º 20
0
	private void LaunchRotateProperty(EMMotionProperties properties, bool useCurrentState,bool reverse){

		Vector3 start=startTransform.rotation;
		Vector3 end=properties.transform.rotation;
		float delay=0;
		
		if (reverse){
			start=end;
			end=startTransform.rotation;
		}
		

		if (useCurrentState){
			start = cachedTransform.localRotation.eulerAngles;
		}
		else{
			delay = properties.rotateEasing.delay;
		}
		
		EMEasing.ValueTo( gameObject,motionId,properties.rotateEasing.easeType, start, end,properties.rotateEasing.time,delay,"On_StartMotion","On_RotateUI","On_EndMotion");

		cachedTransform.localRotation = Quaternion.Euler( start);

	}
Ejemplo n.º 21
0
	protected EMTransform GetTransformFromProperties(EMMotionProperties prop, bool useCurrent){

		EMTransform transform = new EMTransform();

		if (prop.isMove){

			if (prop.moveDirection != EMMotionProperties.MotionDirection.UserDefined){
				transform.anchorMin = startTransform.anchorMin;
				transform.anchorMax = startTransform.anchorMax;

				Vector3 scale = startTransform.scale;
				if (useCurrent){
					scale = cachedTransform.localScale;
				}
				if (prop.isScale){
					scale = prop.transform.scale;
				}

				if (useCurrent){
					transform.position = ComputePosition(cachedTransform.anchoredPosition, prop.moveDirection,scale, prop.isInside);
				}
				else{
					transform.position = ComputePosition(startTransform.position, prop.moveDirection,scale, prop.isInside);
				}
			}
			else{
				transform.anchorMin = prop.transform.anchorMin;
				transform.anchorMax = prop.transform.anchorMax;
				transform.position = prop.transform.position;
			}
		}
		else{
			transform.position = startTransform.position;
			transform.anchorMin = startTransform.anchorMin;
			transform.anchorMax = startTransform.anchorMax;

		}

		if (prop.isRotate){
			transform.rotation = prop.transform.rotation;
		}
		else{
			transform.rotation = startTransform.rotation;
		}

		if (prop.isScale){
			transform.scale = prop.transform.scale;
		}
		else{
			transform.scale = startTransform.scale;
		}

		if (prop.isAlpha){
			transform.alpha = prop.transform.alpha;
		}
		else{
			transform.alpha = startTransform.alpha;
		}

		return transform;
	}
Ejemplo n.º 22
0
	protected Vector3 ComputePosition(Vector3 anchoredPosition,EMMotionProperties.MotionDirection direction, Vector3 scale, bool inside){

		Vector2 pivotOffset = new Vector2(cachedTransform.sizeDelta.x * cachedTransform.pivot.x * scale.x, cachedTransform.sizeDelta.y * cachedTransform.pivot.y * scale.y);
		Vector3 position = anchoredPosition;

		switch (direction){
			case EMMotionProperties.MotionDirection.Top:
				if (!inside)
					position.y = originOffset.y + GetScalerResolution().y + pivotOffset.y;
				else
					position.y = originOffset.y + GetScalerResolution().y - pivotOffset.y;
				break;
			case EMMotionProperties.MotionDirection.Right:
				if (!inside)
					position.x = originOffset.x + GetScalerResolution().x + pivotOffset.x;
				else
					position.x = originOffset.x + GetScalerResolution().x - pivotOffset.x;
				break;
			case EMMotionProperties.MotionDirection.Bottom:
				if (!inside)
					position.y = originOffset.y -  pivotOffset.y;
				else
					position.y = originOffset.y + pivotOffset.y;
				break;
			case EMMotionProperties.MotionDirection.Left:
				if (!inside)
					position.x = originOffset.x - pivotOffset.x;
				else
					position.x = originOffset.x + pivotOffset.x;
				break;
		}
		
		return position;
		
	}
Ejemplo n.º 23
0
	private void LaunchAlphaProperty(EMMotionProperties properties, bool useCurrentState,bool reverse){

		float start=startTransform.alpha;
		float end=properties.transform.alpha;
		float delay=0;
		
		if (reverse){
			start=end;
			end=startTransform.alpha;
		}
		
		if (useCurrentState){
			start = cachedCanvasGroup.alpha;	
		}
		else{
			delay = properties.alphaEasing.delay;
		}
		
		EMEasing.ValueTo( gameObject,motionId,properties.alphaEasing.easeType, start, end,properties.alphaEasing.time,delay,"On_StartMotion","On_AlphaUI","On_EndMotion");

		cachedCanvasGroup.alpha = start;
	}
Ejemplo n.º 24
0
	private void LaunchScaleProperty(EMMotionProperties properties, bool useCurrentState,bool reverse){

		Vector3 start = startTransform.scale;
		Vector3 end = properties.transform.scale;
		float delay = 0;
		
		if (reverse){
			start=end;
			end=startTransform.scale;
		}
			
		if (useCurrentState){
			start = cachedTransform.localScale;
		}
		else{
			delay = properties.scaleEasing.delay;
		}
		
		EMEasing.ValueTo( gameObject,motionId,properties.scaleEasing.easeType, start, end,properties.scaleEasing.time,delay,"On_StartMotion","On_ScaleUI","On_EndMotion");

		cachedTransform.localScale = start;
	}