private void StartAnimation(ItemState p_state) { float __start = (p_state == ItemState.Enabled) ? 1f : 0.2f; float __finish = (p_state == ItemState.Enabled) ? 0.2f : 1f; _nodeOpenAnimation?.Cancel(); _nodeOpenAnimation = Tween.FloatTo(__start, __finish, .25f, EaseType.LINEAR, (float p_value) => { transform.localScale = new Vector3(1f, p_value, 1f); }); }
/// <summary> /// Function that display the information of passed node. /// </summary> public void DisplayTweenNodeData(TweenNode __node) { GUILayout.Label("\tUsedByClass: " + __node.delegatedCallback.Method.ReflectedType.FullName); GUILayout.Label("\tMethod: " + __node.delegatedCallback.Method.Name); GUILayout.Label("\tStartValue:" + __node.startValue); GUILayout.Label("\tFinalValue:" + __node.endValue); GUILayout.Label("\tDuration:" + __node.duration); GUILayout.Label("\tCurrent Time Step:" + __node.currentTimeStep); GUILayout.Label("\tCurrent State:" + __node.currentState); GUILayout.Label("\tUpdate Mode:" + __node.updateMode); GUILayout.Label("\tLoop Mode:" + __node.loopMode); if (__node.loopMode != TweenLoopType.NONE) { if (__node.loopMode == TweenLoopType.PING_PONG) { string __text = "\tPingPongState: NORMAL"; if (__node.isPingPongGoingBack) { __text = "\tPingPongState: Reverse"; } GUILayout.Label(__text); } } GUILayout.Label("\tTimeScale Mode:" + __node.useTimeScale); if (__node.associatedObject) { GUILayout.BeginHorizontal(); GUILayout.Label("\tAssociated GameObject:" + __node.associatedObject.name); if (GUILayout.Button("Select")) { Selection.activeGameObject = __node.associatedObject; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }
protected void StartAnimation(ViewAnimations p_animation, Action p_action) { float __startValue, __endValue; switch (p_animation) { case ViewAnimations.Show: __startValue = 0f; __endValue = 1f; break; case ViewAnimations.Hide: __startValue = 1f; __endValue = 0f; break; default: throw new NotImplementedException($"Animation {p_animation} not implemented."); } _nodeAnimation?.Cancel(); _nodeAnimation = Tween.FloatTo(__startValue, __endValue, GameSettings.MENU_ANIMATION_DURATION, EaseType.LINEAR, Animate); _nodeAnimation.onFinish = p_action; }
/// <summary> /// Function to be called from a TweenNode to add itself to this module dictionary. /// </summary> public void AddNode(TweenNode p_node, UpdateTimeType p_updateMode) { _listOfNodes.Add(p_node); }