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); }); }
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; }