(client)feat:实现子弹定义以及生成,实现初始化动画,实现血条 (#43)
Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
@ -26,9 +26,9 @@ namespace Prefab
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(Data.PawnDef pawnDef)
|
||||
public void Init(Data.EntityDef entityDef)
|
||||
{
|
||||
entity.Init(pawnDef);
|
||||
entity.Init(entityDef);
|
||||
|
||||
outline.Init();
|
||||
outline.Hide();
|
||||
|
18
Client/Assets/Scripts/Prefab/ProgressBarPrefab.cs
Normal file
18
Client/Assets/Scripts/Prefab/ProgressBarPrefab.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Prefab
|
||||
{
|
||||
public class ProgressBarPrefab:MonoBehaviour
|
||||
{
|
||||
public GameObject _progress;
|
||||
public float Progress
|
||||
{
|
||||
get => _progress.transform.localScale.x;
|
||||
set
|
||||
{
|
||||
var x=Mathf.Clamp01(value);
|
||||
_progress.transform.localScale = new Vector3(x, _progress.transform.localScale.y, _progress.transform.localScale.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/Prefab/ProgressBarPrefab.cs.meta
Normal file
3
Client/Assets/Scripts/Prefab/ProgressBarPrefab.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 605f185650fe46d89a6e0d60fb8fb11c
|
||||
timeCreated: 1755091112
|
@ -5,7 +5,7 @@ using UnityEngine.EventSystems;
|
||||
|
||||
namespace Prefab
|
||||
{
|
||||
public class RightMenuPrefab: Utils.MonoSingleton<RightMenuPrefab>,IPointerExitHandler
|
||||
public class RightMenuPrefab: MonoBehaviour,IPointerExitHandler
|
||||
{
|
||||
public GameObject menu;
|
||||
public ButtonPrefab buttonPrefab;
|
||||
@ -17,7 +17,7 @@ namespace Prefab
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
public void Init(List<(string name, UnityAction callback)> buttons)
|
||||
@ -27,8 +27,6 @@ namespace Prefab
|
||||
Debug.LogError("Menu or ButtonPrefab is not assigned!");
|
||||
return;
|
||||
}
|
||||
|
||||
ClearMenu();
|
||||
foreach (var (label, callback) in buttons)
|
||||
{
|
||||
// 实例化按钮预制体
|
||||
@ -68,19 +66,6 @@ namespace Prefab
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ClearMenu()
|
||||
{
|
||||
// 遍历菜单下的所有子对象并销毁它们
|
||||
foreach (Transform child in menu.transform)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
protected override void OnStart()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
Hide();
|
||||
|
Reference in New Issue
Block a user