DiceUI.cs 592 B

12345678910111213141516171819202122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using DG.Tweening;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class DiceUI : MonoBehaviour {
  7. private Image sprite;
  8. public InputM.KeyType keybind;
  9. void Start() {
  10. sprite = GetComponent<Image>();
  11. }
  12. private bool isKeyDown = false;
  13. void Update() {
  14. if (isKeyDown == InputM.GetKeyUI(keybind)) return;
  15. isKeyDown = !isKeyDown;
  16. sprite.DOColor(isKeyDown ? new Color(49f / 255f, 38f / 255f, 31f / 255f, 1) : new Color(111f / 255f, 93f / 255f, 80f / 255f, 1), 0.05f);
  17. }
  18. }