(client)feat:实现子弹定义以及生成,实现初始化动画,实现血条 (#43)

Co-authored-by: zzdxxz <2079238449@qq.com>
Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
2025-08-19 20:22:10 +08:00
committed by TheRedApricot
parent 670f778eee
commit d91210a6ff
119 changed files with 4797 additions and 2929 deletions

View File

@ -0,0 +1,63 @@
using System.Collections.Generic;
using Prefab;
using UnityEngine;
using UnityEngine.Events;
namespace Managers
{
public class RightMenuManager:Utils.MonoSingleton<RightMenuManager>
{
[SerializeField]
private GameObject _canvas;
[SerializeField]
private RightMenuPrefab _rightMenuPrefab;
public GameObject Canvas
{
get
{
if (_canvas == null)
{
_canvas = GameObject.Find("Canvas"); // 根据你的实际场景修改查找条件
if (_canvas == null)
{
Debug.LogError("RightMenu Canvas not found in scene!");
}
}
return _canvas;
}
}
public RightMenuPrefab RightMenuPrefab
{
get
{
if (_rightMenuPrefab == null)
{
_rightMenuPrefab = Resources.Load<RightMenuPrefab>("Prefab/RightMenu");
if (_rightMenuPrefab == null)
{
Debug.LogError("RightMenuPrefab not found in Resources!");
}
}
return _rightMenuPrefab;
}
}
public static void GenerateRightMenu(List<(string name, UnityAction callback)> buttons,Vector3 position)
{
var rightMenuObj = Instantiate(RightMenuManager.Instance.RightMenuPrefab.gameObject,
RightMenuManager.Instance.Canvas.transform);
var rightMenu=rightMenuObj.GetComponent<RightMenuPrefab>();
rightMenu.Init(buttons);
rightMenu.transform.position = position;
rightMenu.Show();
}
protected override void OnStart()
{
}
}
}