(client) feat:实现热重载,实现多维度,实现武器,实现掉落物,实现状态UI,实现攻击AI (#44)

Co-authored-by: zzdxxz <2079238449@qq.com>
Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
2025-08-27 19:56:49 +08:00
committed by TheRedApricot
parent d91210a6ff
commit 8456b6c162
132 changed files with 18568 additions and 2534 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AI;
using Base;
@ -37,11 +38,17 @@ namespace Prefab
public void DefaultInit()
{
var animator = GetComponentsInChildren<SpriteAnimator>();
ITick[] inf = animator;
entity.bodyAnimationNode.Add(Orientation.Down,inf.ToList());
entity.bodyAnimationNode.Add(Orientation.Up,inf.ToList());
entity.bodyAnimationNode.Add(Orientation.Left,inf.ToList());
entity.bodyAnimationNode.Add(Orientation.Right,inf.ToList());
var inf = animator.Cast<ITick>().ToArray();
foreach (EntityState state in Enum.GetValues(typeof(EntityState)))
{
var orientationDict = new Dictionary<Orientation, ITick[]>();
foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
{
orientationDict[orientation] = inf; // 所有值都指向同一个列表
}
entity.bodyAnimationNode[state] = orientationDict;
}
outline.Init();
outline.Hide();
}

View 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);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cda5c2669c504f77bb60cdd9ce591e63
timeCreated: 1755663454

View File

@ -1,3 +1,4 @@
using System;
using Base;
using UnityEngine;
@ -64,7 +65,7 @@ namespace Prefab
// 更新帧计时器
_frameTimer += deltaTime;
float frameDuration = 1f / _fps;
var frameDuration = 1f / _fps;
// 检查帧切换条件
while (_frameTimer >= frameDuration)
@ -101,6 +102,13 @@ namespace Prefab
// 重置帧计时器,以确保从头开始播放
_frameTimer = 0f;
}
public void Restore()
{
_currentFrameIndex = 0;
_renderer.sprite = _sprites[_currentFrameIndex];
}
public void SetFPS(float newFPS) => _fps = Mathf.Max(0.1f, newFPS);
public void SetStaticSprite(Sprite sprite) => _staticSprite = sprite;
}