mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 01:07:14 +08:00
(client) feat:实现热重载,实现多维度,实现武器,实现掉落物,实现状态UI,实现攻击AI (#44)
Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
43
Client/Assets/Scripts/Prefab/HoverButtonPrefab.cs
Normal file
43
Client/Assets/Scripts/Prefab/HoverButtonPrefab.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Prefab
|
||||
{
|
||||
// [RequireComponent(typeof(CircleCollider2D))]
|
||||
public class HoverButtonPrefab:MonoBehaviour
|
||||
{
|
||||
public TMP_Text text;
|
||||
public Button button;
|
||||
// public CircleCollider2D circleCollider;
|
||||
|
||||
public float startRadius = 250;
|
||||
public float endRadius = 100;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// circleCollider.radius=startRadius;
|
||||
}
|
||||
|
||||
public void OnMouseOver()
|
||||
{
|
||||
var dir= (Input.mousePosition - transform.position).magnitude;
|
||||
|
||||
var color = button.image.color;
|
||||
color.a = Mathf.Min((startRadius - dir) / (startRadius - endRadius), 1);
|
||||
button.image.color = color;
|
||||
}
|
||||
|
||||
public void OnMouseEnter()
|
||||
{
|
||||
button.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void OnMouseExit()
|
||||
{
|
||||
button.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user