Imported UI Assets
This commit is contained in:
@ -0,0 +1,66 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class ButtonFrame : MonoBehaviour
|
||||
{
|
||||
// Resources
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private ButtonManager buttonManager;
|
||||
[SerializeField] private PanelButton panelButton;
|
||||
|
||||
// Settings
|
||||
[SerializeField] private ButtonType buttonType = ButtonType.ButtonManager;
|
||||
|
||||
public enum ButtonType { ButtonManager, PanelButton }
|
||||
|
||||
void Start()
|
||||
{
|
||||
if ((buttonType == ButtonType.ButtonManager && buttonManager == null) || (buttonType == ButtonType.PanelButton && panelButton == null)) { return; }
|
||||
if (animator == null) { animator = GetComponent<Animator>(); }
|
||||
|
||||
if (buttonType == ButtonType.ButtonManager)
|
||||
{
|
||||
buttonManager.onHover.AddListener(delegate { DoIn(); });
|
||||
buttonManager.onLeave.AddListener(delegate { DoOut(); });
|
||||
buttonManager.onSelect.AddListener(delegate { DoIn(); });
|
||||
buttonManager.onDeselect.AddListener(delegate { DoOut(); });
|
||||
}
|
||||
|
||||
else if (buttonType == ButtonType.PanelButton)
|
||||
{
|
||||
panelButton.onHover.AddListener(delegate { DoIn(); });
|
||||
panelButton.onLeave.AddListener(delegate { DoOut(); });
|
||||
panelButton.onSelect.AddListener(delegate { DoOut(); });
|
||||
}
|
||||
|
||||
animator.enabled = false;
|
||||
}
|
||||
|
||||
public void DoIn()
|
||||
{
|
||||
animator.enabled = true;
|
||||
animator.CrossFade("In", 0.15f);
|
||||
|
||||
StopCoroutine("DisableAnimator");
|
||||
StartCoroutine("DisableAnimator");
|
||||
}
|
||||
|
||||
public void DoOut()
|
||||
{
|
||||
animator.enabled = true;
|
||||
animator.CrossFade("Out", 0.15f);
|
||||
|
||||
StopCoroutine("DisableAnimator");
|
||||
StartCoroutine("DisableAnimator");
|
||||
}
|
||||
|
||||
IEnumerator DisableAnimator()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(HeatUIInternalTools.GetAnimatorClipLength(animator, "ButtonFrame_In"));
|
||||
animator.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39c56966751bb904197e746678f1cfb2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/ButtonFrame.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,43 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(ButtonFrame))]
|
||||
public class ButtonFrameEditor : Editor
|
||||
{
|
||||
private ButtonFrame bfTarget;
|
||||
private GUISkin customSkin;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
bfTarget = (ButtonFrame)target;
|
||||
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
|
||||
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var animator = serializedObject.FindProperty("animator");
|
||||
var buttonManager = serializedObject.FindProperty("buttonManager");
|
||||
var panelButton = serializedObject.FindProperty("panelButton");
|
||||
var buttonType = serializedObject.FindProperty("buttonType");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
|
||||
HeatUIEditorHandler.DrawProperty(animator, customSkin, "Animator");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
HeatUIEditorHandler.DrawPropertyPlain(buttonType, customSkin, "Animator");
|
||||
if (buttonType.enumValueIndex == 0) { HeatUIEditorHandler.DrawProperty(buttonManager, customSkin, "Button Manager"); }
|
||||
else if (buttonType.enumValueIndex == 1) { HeatUIEditorHandler.DrawProperty(panelButton, customSkin, "Panel Button"); }
|
||||
GUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff92d25caab9bb5479aac96469e03b2c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/ButtonFrameEditor.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,95 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[RequireComponent(typeof(Image))]
|
||||
[AddComponentMenu("Heat UI/Animation/Image Fading")]
|
||||
public class ImageFading : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[SerializeField] private bool doPingPong = false;
|
||||
[SerializeField] [Range(0.5f, 12)] private float fadeSpeed = 2f;
|
||||
[SerializeField] private AnimationCurve fadeCurve = new AnimationCurve(new Keyframe(0.0f, 0.0f), new Keyframe(1.0f, 1.0f));
|
||||
[SerializeField] private EnableBehaviour enableBehaviour;
|
||||
|
||||
[Header("Events")]
|
||||
public UnityEvent onFadeIn;
|
||||
public UnityEvent onFadeInEnd;
|
||||
public UnityEvent onFadeOut;
|
||||
public UnityEvent onFadeOutEnd;
|
||||
|
||||
// Helpers
|
||||
Image targetImg;
|
||||
|
||||
public enum EnableBehaviour { None, FadeIn, FadeOut }
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (enableBehaviour == EnableBehaviour.FadeIn) { FadeIn(); }
|
||||
else if (enableBehaviour == EnableBehaviour.FadeOut) { FadeOut(); }
|
||||
}
|
||||
|
||||
public void FadeIn()
|
||||
{
|
||||
if (gameObject.activeSelf == false) { gameObject.SetActive(true); }
|
||||
if (targetImg == null) { targetImg = GetComponent<Image>(); }
|
||||
|
||||
targetImg.color = new Color(targetImg.color.r, targetImg.color.g, targetImg.color.b, 0);
|
||||
onFadeIn.Invoke();
|
||||
|
||||
StopCoroutine("DoFadeIn");
|
||||
StopCoroutine("DoFadeOut");
|
||||
StartCoroutine("DoFadeIn");
|
||||
}
|
||||
|
||||
public void FadeOut()
|
||||
{
|
||||
if (gameObject.activeSelf == false) { gameObject.SetActive(true); }
|
||||
if (targetImg == null) { targetImg = GetComponent<Image>(); }
|
||||
|
||||
targetImg.color = new Color(targetImg.color.r, targetImg.color.g, targetImg.color.b, 1);
|
||||
onFadeOut.Invoke();
|
||||
|
||||
StopCoroutine("DoFadeIn");
|
||||
StopCoroutine("DoFadeOut");
|
||||
StartCoroutine("DoFadeOut");
|
||||
}
|
||||
|
||||
IEnumerator DoFadeIn()
|
||||
{
|
||||
Color startingPoint = new Color(targetImg.color.r, targetImg.color.g, targetImg.color.b, 0);
|
||||
float elapsedTime = 0;
|
||||
|
||||
while (targetImg.color.a < 0.99f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
targetImg.color = Color.Lerp(startingPoint, new Color(startingPoint.r, startingPoint.g, startingPoint.b, 1), fadeCurve.Evaluate(elapsedTime * fadeSpeed)); ;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
targetImg.color = new Color(targetImg.color.r, targetImg.color.g, targetImg.color.b, 1);
|
||||
onFadeInEnd.Invoke();
|
||||
if (doPingPong == true) { StartCoroutine("DoFadeOut"); }
|
||||
}
|
||||
|
||||
IEnumerator DoFadeOut()
|
||||
{
|
||||
Color startingPoint = targetImg.color;
|
||||
float elapsedTime = 0;
|
||||
|
||||
while (targetImg.color.a > 0.01f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
targetImg.color = Color.Lerp(startingPoint, new Color(startingPoint.r, startingPoint.g, startingPoint.b, 0), fadeCurve.Evaluate(elapsedTime * fadeSpeed)); ;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
targetImg.color = new Color(targetImg.color.r, targetImg.color.g, targetImg.color.b, 0);
|
||||
onFadeOutEnd.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a40819193417bd641b0c711d515cbfa6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/ImageFading.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[AddComponentMenu("Heat UI/Animation/Image Pulse")]
|
||||
public class ImagePulse : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
[SerializeField] private Image targetImage;
|
||||
|
||||
[Header("Color")]
|
||||
[Range(0, 1)] public float minAlpha = 0.25f;
|
||||
[Range(0, 1)] public float maxAlpha = 1;
|
||||
|
||||
[Header("Animation")]
|
||||
[Range(0.5f, 10)] public float pulseSpeed = 1;
|
||||
[SerializeField] private AnimationCurve pulseCurve = new AnimationCurve(new Keyframe(0.0f, 0.0f), new Keyframe(1.0f, 1.0f));
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
StartPulse();
|
||||
}
|
||||
|
||||
public void StartPulse()
|
||||
{
|
||||
if (gameObject.activeSelf == false) { gameObject.SetActive(true); }
|
||||
if (targetImage == null) { targetImage = GetComponent<Image>(); }
|
||||
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, minAlpha);
|
||||
|
||||
StopCoroutine("PulseInAnimation");
|
||||
StopCoroutine("PulseOutAnimation");
|
||||
StartCoroutine("PulseInAnimation");
|
||||
}
|
||||
|
||||
IEnumerator PulseInAnimation()
|
||||
{
|
||||
float elapsedTime = 0;
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, minAlpha);
|
||||
|
||||
while (targetImage.color.a < maxAlpha)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, Mathf.Lerp(minAlpha, maxAlpha, pulseCurve.Evaluate(elapsedTime * pulseSpeed)));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, maxAlpha);
|
||||
StartCoroutine("PulseOutAnimation");
|
||||
}
|
||||
|
||||
IEnumerator PulseOutAnimation()
|
||||
{
|
||||
float elapsedTime = 0;
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, maxAlpha);
|
||||
|
||||
while (targetImage.color.a > minAlpha)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, Mathf.Lerp(maxAlpha, minAlpha, pulseCurve.Evaluate(elapsedTime * pulseSpeed)));
|
||||
yield return null;
|
||||
}
|
||||
|
||||
targetImage.color = new Color(targetImage.color.r, targetImage.color.g, targetImage.color.b, minAlpha);
|
||||
StartCoroutine("PulseInAnimation");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e493d5e4e9119a943904d5d8255bafba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/ImagePulse.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,110 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[RequireComponent(typeof(Animator))]
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class NavigationBar : MonoBehaviour
|
||||
{
|
||||
// Resources
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private CanvasGroup canvasGroup;
|
||||
|
||||
// Settings
|
||||
[SerializeField] private UpdateMode updateMode = UpdateMode.DeltaTime;
|
||||
[SerializeField] private BarDirection barDirection = BarDirection.Top;
|
||||
[SerializeField] private bool fadeButtons = false;
|
||||
[SerializeField] private Transform buttonParent;
|
||||
|
||||
// Helpers
|
||||
float cachedStateLength = 0.4f;
|
||||
List<PanelButton> buttons = new List<PanelButton>();
|
||||
|
||||
public enum UpdateMode { DeltaTime, UnscaledTime }
|
||||
public enum BarDirection { Top, Bottom }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (animator == null) { GetComponent<Animator>(); }
|
||||
if (canvasGroup == null) { GetComponent<CanvasGroup>(); }
|
||||
if (fadeButtons && buttonParent != null) { FetchButtons(); }
|
||||
|
||||
cachedStateLength = HeatUIInternalTools.GetAnimatorClipLength(animator, "NavigationBar_TopShow") + 0.02f;
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
Show();
|
||||
}
|
||||
|
||||
public void FetchButtons()
|
||||
{
|
||||
buttons.Clear();
|
||||
|
||||
foreach (Transform child in buttonParent)
|
||||
{
|
||||
if (child.GetComponent<PanelButton>() != null)
|
||||
{
|
||||
PanelButton btn = child.GetComponent<PanelButton>();
|
||||
btn.navbar = this;
|
||||
buttons.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LitButtons(PanelButton source = null)
|
||||
{
|
||||
foreach (PanelButton btn in buttons)
|
||||
{
|
||||
if (btn.isSelected || (source != null && btn == source))
|
||||
continue;
|
||||
|
||||
btn.IsInteractable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void DimButtons(PanelButton source)
|
||||
{
|
||||
foreach (PanelButton btn in buttons)
|
||||
{
|
||||
if (btn.isSelected || btn == source)
|
||||
continue;
|
||||
|
||||
btn.IsInteractable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
animator.enabled = true;
|
||||
|
||||
StopCoroutine("DisableAnimator");
|
||||
StartCoroutine("DisableAnimator");
|
||||
|
||||
if (barDirection == BarDirection.Top) { animator.Play("Top Show"); }
|
||||
else if (barDirection == BarDirection.Bottom) { animator.Play("Bottom Show"); }
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
animator.enabled = true;
|
||||
|
||||
StopCoroutine("DisableAnimator");
|
||||
StartCoroutine("DisableAnimator");
|
||||
|
||||
if (barDirection == BarDirection.Top) { animator.Play("Top Hide"); }
|
||||
else if (barDirection == BarDirection.Bottom) { animator.Play("Bottom Hide"); }
|
||||
}
|
||||
|
||||
IEnumerator DisableAnimator()
|
||||
{
|
||||
if (updateMode == UpdateMode.DeltaTime) { yield return new WaitForSeconds(cachedStateLength); }
|
||||
else { yield return new WaitForSecondsRealtime(cachedStateLength); }
|
||||
|
||||
animator.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b212167ae6cb6d42afd331401af0d53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/NavigationBar.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,50 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(NavigationBar))]
|
||||
public class NavigationBarEditor : Editor
|
||||
{
|
||||
private NavigationBar navTarget;
|
||||
private GUISkin customSkin;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
navTarget = (NavigationBar)target;
|
||||
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
|
||||
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var animator = serializedObject.FindProperty("animator");
|
||||
var canvasGroup = serializedObject.FindProperty("canvasGroup");
|
||||
|
||||
var updateMode = serializedObject.FindProperty("updateMode");
|
||||
var barDirection = serializedObject.FindProperty("barDirection");
|
||||
var fadeButtons = serializedObject.FindProperty("fadeButtons");
|
||||
var buttonParent = serializedObject.FindProperty("buttonParent");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
|
||||
HeatUIEditorHandler.DrawProperty(animator, customSkin, "Animator");
|
||||
HeatUIEditorHandler.DrawProperty(canvasGroup, customSkin, "Canvas Group");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
GUILayout.Space(-3);
|
||||
fadeButtons.boolValue = HeatUIEditorHandler.DrawTogglePlain(fadeButtons.boolValue, customSkin, "Fade Panel Buttons");
|
||||
GUILayout.Space(4);
|
||||
if (fadeButtons.boolValue == true) { HeatUIEditorHandler.DrawProperty(buttonParent, customSkin, "Button Parent"); }
|
||||
GUILayout.EndVertical();
|
||||
HeatUIEditorHandler.DrawProperty(updateMode, customSkin, "Update Mode");
|
||||
HeatUIEditorHandler.DrawProperty(barDirection, customSkin, "Bar Direction");
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 004e7221dd8ff2e48836b109bbd46839
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/NavigationBarEditor.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,42 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[AddComponentMenu("Heat UI/Animation/Rect Depth")]
|
||||
public class RectDepth : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[SerializeField] [Range(0.05f, 1)] private float smoothness = 0.25f;
|
||||
[SerializeField] [Range(0.5f, 10)] private float multiplier = 2;
|
||||
[SerializeField] [Range(1, 2)] private float maxRectScale = 1;
|
||||
|
||||
[Header("Resources")]
|
||||
[SerializeField] private RectTransform targetRect;
|
||||
[SerializeField] private Canvas targetCanvas;
|
||||
[SerializeField] private Camera targetCamera;
|
||||
|
||||
private Vector2 mousePos;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (targetRect == null) { targetRect = GetComponent<RectTransform>(); }
|
||||
if (targetCanvas == null) { targetCanvas = GetComponentInParent<Canvas>(); }
|
||||
if (targetCamera == null) { targetCamera = Camera.main; }
|
||||
|
||||
targetRect.transform.localScale = new Vector3(maxRectScale, maxRectScale, maxRectScale);
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
targetRect.anchoredPosition = new Vector2(0, 0);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(targetCanvas.transform as RectTransform, Mouse.current.position.ReadValue(), targetCamera, out mousePos);
|
||||
targetRect.anchoredPosition = Vector2.Lerp(targetRect.anchoredPosition, targetCanvas.transform.TransformPoint(mousePos) * multiplier, smoothness / (multiplier * 4f));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce3649032ad7fd34fae6acf8bf789c90
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/RectDepth.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[AddComponentMenu("Heat UI/Animation/Shiny Image")]
|
||||
public class ShinyImage : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
[SerializeField] private RectTransform targetRect;
|
||||
[SerializeField] private RectTransform parentRect;
|
||||
|
||||
[Header("Animation")]
|
||||
[SerializeField][Range(0, 4)] private float delay = 0.25f;
|
||||
[SerializeField] [Range(0.25f, 4)] private float animationSpeed = 1;
|
||||
[SerializeField] private AnimationCurve animationCurve = new AnimationCurve(new Keyframe(0.0f, 0.0f), new Keyframe(1.0f, 1.0f));
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
StartShiny();
|
||||
}
|
||||
|
||||
public void StartShiny()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (targetRect == null) { targetRect = GetComponent<RectTransform>(); }
|
||||
if (parentRect == null) { parentRect = transform.parent.GetComponent<RectTransform>(); }
|
||||
|
||||
StopCoroutine("ShinyAnimation");
|
||||
StartCoroutine("ShinyAnimation");
|
||||
}
|
||||
|
||||
IEnumerator ShinyAnimation()
|
||||
{
|
||||
float elapsedTime = 0;
|
||||
Vector2 startPos = new Vector2(-parentRect.sizeDelta.x, targetRect.anchoredPosition.y);
|
||||
Vector2 endPos = new Vector2(+parentRect.sizeDelta.x, targetRect.anchoredPosition.y);
|
||||
targetRect.anchoredPosition = startPos;
|
||||
|
||||
while (targetRect.anchoredPosition.x < endPos.x - 0.1f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
targetRect.anchoredPosition = new Vector2(Mathf.Lerp(startPos.x, endPos.x, animationCurve.Evaluate(elapsedTime * animationSpeed)), targetRect.anchoredPosition.y);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
targetRect.anchoredPosition = endPos;
|
||||
if (delay == 0) { StartCoroutine("ShinyAnimation"); }
|
||||
else { StartCoroutine("ShinyAnimationDelay"); }
|
||||
}
|
||||
|
||||
IEnumerator ShinyAnimationDelay()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(delay);
|
||||
StartCoroutine("ShinyAnimation");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbd7f24c06b40d34c94a6e79b58382c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/ShinyImage.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[AddComponentMenu("Heat UI/Animation/Spinner")]
|
||||
public class Spinner : MonoBehaviour
|
||||
{
|
||||
[Header("Resources")]
|
||||
[SerializeField] private RectTransform objectToSpin;
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] [Range(0.1f, 50)] private float speed = 10;
|
||||
[SerializeField] private Direction direction;
|
||||
float currentPos;
|
||||
|
||||
public enum Direction { Clockwise, CounterClockwise }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (objectToSpin == null)
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (direction == Direction.Clockwise)
|
||||
{
|
||||
currentPos -= speed * 100 * Time.unscaledDeltaTime;
|
||||
if (currentPos >= 360) { currentPos = 0; }
|
||||
}
|
||||
|
||||
else if (direction == Direction.CounterClockwise)
|
||||
{
|
||||
currentPos += speed * 100 * Time.unscaledDeltaTime;
|
||||
if (currentPos <= -360) { currentPos = 0; }
|
||||
}
|
||||
|
||||
objectToSpin.localRotation = Quaternion.Euler(0, 0, currentPos);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59113c108d68d6e4dae023185341cb2f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 15c8d78db352ebe41959a2ea952c3ab0, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/Spinner.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,321 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
[AddComponentMenu("Heat UI/Animation/UI Popup")]
|
||||
public class UIPopup : MonoBehaviour
|
||||
{
|
||||
[Header("Settings")]
|
||||
[SerializeField] private bool playOnEnable = true;
|
||||
[SerializeField] private bool closeOnDisable = false;
|
||||
[SerializeField] private bool instantOut = false;
|
||||
[Tooltip("Enables content size fitter mode.")]
|
||||
[SerializeField] private bool fitterMode = false;
|
||||
[SerializeField] private StartBehaviour startBehaviour;
|
||||
|
||||
[Header("Animation")]
|
||||
[SerializeField] private AnimationMode animationMode;
|
||||
[SerializeField] private AnimationCurve animationCurve = new AnimationCurve(new Keyframe(0.0f, 0.0f), new Keyframe(1.0f, 1.0f));
|
||||
[Range(0.5f, 10)] public float curveSpeed = 4f;
|
||||
|
||||
[Header("Events")]
|
||||
public UnityEvent onEnable = new UnityEvent();
|
||||
public UnityEvent onVisible = new UnityEvent();
|
||||
public UnityEvent onDisable = new UnityEvent();
|
||||
|
||||
// Helpers
|
||||
RectTransform rect;
|
||||
CanvasGroup cg;
|
||||
Vector2 rectHelper;
|
||||
bool isInitialized = false;
|
||||
bool isFitterInitialized = false;
|
||||
[HideInInspector] public bool isOn = false;
|
||||
|
||||
public enum AnimationMode { Scale, Horizontal, Vertical }
|
||||
public enum StartBehaviour { Default, Disabled, Static }
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (startBehaviour == StartBehaviour.Disabled)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (!isInitialized) { Initialize(); }
|
||||
if (playOnEnable) { PlayIn(); }
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (closeOnDisable)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
isOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (rect == null) { rect = GetComponent<RectTransform>(); }
|
||||
if (cg == null) { cg = GetComponent<CanvasGroup>(); }
|
||||
if (startBehaviour == StartBehaviour.Disabled || startBehaviour == StartBehaviour.Static) { rectHelper = rect.sizeDelta; }
|
||||
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
public void ResetFitterData()
|
||||
{
|
||||
isFitterInitialized = false;
|
||||
}
|
||||
|
||||
public void Animate()
|
||||
{
|
||||
if (isOn) { PlayOut(); }
|
||||
else { PlayIn(); }
|
||||
}
|
||||
|
||||
public void PlayIn()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
if (fitterMode && !isFitterInitialized)
|
||||
{
|
||||
cg.alpha = 0;
|
||||
StartCoroutine("InitFitter");
|
||||
return;
|
||||
}
|
||||
|
||||
if (animationMode == AnimationMode.Scale && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("ScaleIn"); }
|
||||
else { cg.alpha = 1; rect.localScale = new Vector3(1, 1, 1); }
|
||||
}
|
||||
|
||||
else if (animationMode == AnimationMode.Horizontal && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("HorizontalIn"); }
|
||||
else { cg.alpha = 1; }
|
||||
}
|
||||
|
||||
else if (animationMode == AnimationMode.Vertical && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("VerticalIn"); }
|
||||
else { cg.alpha = 1; }
|
||||
}
|
||||
|
||||
isOn = true;
|
||||
onEnable.Invoke();
|
||||
}
|
||||
|
||||
public void PlayOut()
|
||||
{
|
||||
if (instantOut)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
isOn = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (animationMode == AnimationMode.Scale && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("ScaleOut"); }
|
||||
else { cg.alpha = 0; rect.localScale = new Vector3(0, 0, 0); gameObject.SetActive(false); }
|
||||
}
|
||||
|
||||
else if (animationMode == AnimationMode.Horizontal && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("HorizontalOut"); }
|
||||
else { cg.alpha = 0; gameObject.SetActive(false); }
|
||||
}
|
||||
|
||||
else if (animationMode == AnimationMode.Vertical && cg != null)
|
||||
{
|
||||
if (gameObject.activeInHierarchy) { StartCoroutine("VerticalOut"); }
|
||||
else { cg.alpha = 0; gameObject.SetActive(false); }
|
||||
}
|
||||
|
||||
isOn = false;
|
||||
onDisable.Invoke();
|
||||
}
|
||||
|
||||
IEnumerator InitFitter()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(0.04f);
|
||||
|
||||
ContentSizeFitter csf = GetComponent<ContentSizeFitter>();
|
||||
csf.enabled = false;
|
||||
|
||||
rectHelper = rect.sizeDelta;
|
||||
isFitterInitialized = true;
|
||||
PlayIn();
|
||||
}
|
||||
|
||||
IEnumerator ScaleIn()
|
||||
{
|
||||
StopCoroutine("ScaleOut");
|
||||
|
||||
float elapsedTime = 0;
|
||||
float startingPoint = 0;
|
||||
float smoothValue = 0;
|
||||
|
||||
rect.localScale = new Vector3(0, 0, 0);
|
||||
cg.alpha = 0;
|
||||
|
||||
while (rect.localScale.x < 0.99)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
smoothValue = Mathf.Lerp(startingPoint, 1, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
rect.localScale = new Vector3(smoothValue, smoothValue, smoothValue);
|
||||
cg.alpha = smoothValue;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 1;
|
||||
rect.localScale = new Vector3(1, 1, 1);
|
||||
onVisible.Invoke();
|
||||
}
|
||||
|
||||
IEnumerator ScaleOut()
|
||||
{
|
||||
StopCoroutine("ScaleIn");
|
||||
|
||||
float elapsedTime = 0;
|
||||
float startingPoint = 1;
|
||||
float smoothValue = 0;
|
||||
|
||||
rect.localScale = new Vector3(1, 1, 1);
|
||||
cg.alpha = 1;
|
||||
|
||||
while (rect.localScale.x > 0.01)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
smoothValue = Mathf.Lerp(startingPoint, 0, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
rect.localScale = new Vector3(smoothValue, smoothValue, smoothValue);
|
||||
cg.alpha = smoothValue;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 0;
|
||||
rect.localScale = new Vector3(0, 0, 0);
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator HorizontalIn()
|
||||
{
|
||||
StopCoroutine("HorizontalOut");
|
||||
|
||||
float elapsedTime = 0;
|
||||
|
||||
Vector2 startPos = new Vector2(0, rect.sizeDelta.y);
|
||||
Vector2 endPos = rectHelper;
|
||||
|
||||
if (!fitterMode && startBehaviour == StartBehaviour.Default) { endPos = rect.sizeDelta; }
|
||||
else if (fitterMode && startBehaviour == StartBehaviour.Default) { endPos = rectHelper; }
|
||||
|
||||
rect.sizeDelta = startPos;
|
||||
|
||||
while (rect.sizeDelta.x <= endPos.x - 0.1f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
|
||||
cg.alpha += Time.unscaledDeltaTime * (curveSpeed * 2);
|
||||
rect.sizeDelta = Vector2.Lerp(startPos, endPos, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 1;
|
||||
rect.sizeDelta = endPos;
|
||||
onVisible.Invoke();
|
||||
}
|
||||
|
||||
IEnumerator HorizontalOut()
|
||||
{
|
||||
StopCoroutine("HorizontalIn");
|
||||
|
||||
float elapsedTime = 0;
|
||||
|
||||
Vector2 startPos = rect.sizeDelta;
|
||||
Vector2 endPos = new Vector2(0, rect.sizeDelta.y);
|
||||
|
||||
while (rect.sizeDelta.x >= 0.1f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
|
||||
cg.alpha -= Time.unscaledDeltaTime * (curveSpeed * 2);
|
||||
rect.sizeDelta = Vector2.Lerp(startPos, endPos, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 0;
|
||||
rect.sizeDelta = endPos;
|
||||
rect.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator VerticalIn()
|
||||
{
|
||||
StopCoroutine("VerticalOut");
|
||||
|
||||
float elapsedTime = 0;
|
||||
|
||||
Vector2 startPos = new Vector2(rect.sizeDelta.x, 0);
|
||||
Vector2 endPos = rectHelper;
|
||||
|
||||
if (!fitterMode && startBehaviour == StartBehaviour.Default) { endPos = rect.sizeDelta; }
|
||||
else if (fitterMode && startBehaviour == StartBehaviour.Default) { endPos = rectHelper; }
|
||||
|
||||
rect.sizeDelta = startPos;
|
||||
|
||||
while (rect.sizeDelta.y <= endPos.y - 0.1f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
|
||||
cg.alpha += Time.unscaledDeltaTime * (curveSpeed * 2);
|
||||
rect.sizeDelta = Vector2.Lerp(startPos, endPos, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 1;
|
||||
rect.sizeDelta = endPos;
|
||||
onVisible.Invoke();
|
||||
}
|
||||
|
||||
IEnumerator VerticalOut()
|
||||
{
|
||||
StopCoroutine("VerticalIn");
|
||||
|
||||
float elapsedTime = 0;
|
||||
|
||||
Vector2 startPos = rect.sizeDelta;
|
||||
Vector2 endPos = new Vector2(rect.sizeDelta.x, 0);
|
||||
|
||||
while (rect.sizeDelta.y >= 0.1f)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
|
||||
cg.alpha -= Time.unscaledDeltaTime * (curveSpeed * 2);
|
||||
rect.sizeDelta = Vector2.Lerp(startPos, endPos, animationCurve.Evaluate(elapsedTime * curveSpeed));
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg.alpha = 0;
|
||||
rect.sizeDelta = endPos;
|
||||
rect.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b802ad4a4b7423d4dad4fbd75775e08f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/UIPopup.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
public class UISway : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("Resources")]
|
||||
[SerializeField] private Canvas mainCanvas;
|
||||
[SerializeField] private Camera mainCamera;
|
||||
[SerializeField] private RectTransform swayObject;
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] [Range(1, 20)] private float smoothness = 10;
|
||||
[SerializeField] private InputType inputType = InputType.Mouse;
|
||||
|
||||
bool allowSway;
|
||||
Vector3 cursorPos;
|
||||
Vector2 defaultPos;
|
||||
|
||||
public enum InputType { Mouse, Touchscreen }
|
||||
|
||||
void Start()
|
||||
{
|
||||
defaultPos = swayObject.anchoredPosition;
|
||||
|
||||
if (mainCamera == null) { mainCamera = Camera.main; }
|
||||
if (mainCanvas == null) { mainCanvas = GetComponentInParent<Canvas>(); }
|
||||
if (swayObject == null) { swayObject = GetComponent<RectTransform>(); }
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (allowSway == true && inputType == InputType.Mouse) { cursorPos = Mouse.current.position.ReadValue(); }
|
||||
else if (allowSway == true && inputType == InputType.Touchscreen) { cursorPos = Touchscreen.current.position.ReadValue(); }
|
||||
|
||||
if (mainCanvas.renderMode == RenderMode.ScreenSpaceOverlay) { ProcessOverlay(); }
|
||||
else if (mainCanvas.renderMode == RenderMode.ScreenSpaceCamera) { ProcessSSC(); }
|
||||
}
|
||||
|
||||
void ProcessOverlay()
|
||||
{
|
||||
if (allowSway == true) { swayObject.position = Vector2.Lerp(swayObject.position, cursorPos, Time.unscaledDeltaTime * smoothness); }
|
||||
else { swayObject.localPosition = Vector2.Lerp(swayObject.localPosition, defaultPos, Time.unscaledDeltaTime * smoothness); }
|
||||
}
|
||||
|
||||
void ProcessSSC()
|
||||
{
|
||||
if (allowSway == true) { swayObject.position = Vector2.Lerp(swayObject.position, mainCamera.ScreenToWorldPoint(cursorPos), Time.unscaledDeltaTime * smoothness); }
|
||||
else { swayObject.localPosition = Vector2.Lerp(swayObject.localPosition, defaultPos, Time.unscaledDeltaTime * smoothness); }
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData data) { allowSway = true; }
|
||||
public void OnPointerExit(PointerEventData data) { allowSway = false; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21efdb94c15fff540a26f74d885ef3a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: b633d2f960ff9e74a901c2047b5e76ea, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 264857
|
||||
packageName: Heat - Complete Modern UI
|
||||
packageVersion: 1.0.4
|
||||
assetPath: Assets/Heat - Complete Modern UI/Scripts/Animation/UISway.cs
|
||||
uploadId: 629893
|
Reference in New Issue
Block a user