根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:
``` docs(readme): 更新文档说明 - 添加项目使用指南 - 完善API接口说明 - 修正错误的配置示例 ```
This commit is contained in:
1 parent
a74d1e62d7
commit
8d58c2223c
167 files changed
+1119
-15679
No files matched your search
@@ -0,0 +1,128 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// 增益系统管理器(单例)
|
||||
/// 管理全局增益效果的应用
|
||||
/// </summary>
|
||||
public class BuffSystem : MonoBehaviour
|
||||
{
|
||||
private static BuffSystem instance;
|
||||
public static BuffSystem Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
var go = new GameObject("BuffSystem");
|
||||
instance = go.AddComponent<BuffSystem>();
|
||||
DontDestroyOnLoad(go);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用群体治疗增益
|
||||
/// </summary>
|
||||
public void ApplyGroupHeal(float healAmount)
|
||||
{
|
||||
var allies = FindObjectsOfType<UnitBase>();
|
||||
int healedCount = 0;
|
||||
|
||||
foreach (var unit in allies)
|
||||
{
|
||||
var team = unit.GetComponent<UnitTeam>();
|
||||
if (team != null && team.teamId == 0) // 友方
|
||||
{
|
||||
var healthBar = unit.GetComponent<WorldHealthBar>();
|
||||
if (healthBar != null)
|
||||
{
|
||||
healthBar.Heal(healAmount);
|
||||
healedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"群体治疗:治疗了 {healedCount} 个友方单位,每个恢复 {healAmount} 生命");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用全局攻速增益
|
||||
/// </summary>
|
||||
public void ApplyGlobalAttackSpeedBuff(float speedMultiplier)
|
||||
{
|
||||
var allies = FindObjectsOfType<UnitBase>();
|
||||
int buffedCount = 0;
|
||||
|
||||
foreach (var unit in allies)
|
||||
{
|
||||
var team = unit.GetComponent<UnitTeam>();
|
||||
if (team != null && team.teamId == 0) // 友方
|
||||
{
|
||||
// 使用 UnitBase 的攻速倍增系统
|
||||
unit.MultiplyAttackSpeed(speedMultiplier, 3f); // 最高3倍攻速
|
||||
buffedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"全局攻速增益:{buffedCount} 个友方单位攻速提升 {(speedMultiplier - 1) * 100}%");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用全局攻击力增益
|
||||
/// </summary>
|
||||
public void ApplyGlobalAttackBuff(float attackMultiplier)
|
||||
{
|
||||
var allies = FindObjectsOfType<UnitBase>();
|
||||
int buffedCount = 0;
|
||||
|
||||
foreach (var unit in allies)
|
||||
{
|
||||
var team = unit.GetComponent<UnitTeam>();
|
||||
if (team != null && team.teamId == 0) // 友方
|
||||
{
|
||||
unit.attackPower *= attackMultiplier;
|
||||
buffedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"全局攻击增益:{buffedCount} 个友方单位攻击力提升 {(attackMultiplier - 1) * 100}%");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用全局生命增益
|
||||
/// </summary>
|
||||
public void ApplyGlobalHealthBuff(float healthMultiplier)
|
||||
{
|
||||
var allies = FindObjectsOfType<UnitBase>();
|
||||
int buffedCount = 0;
|
||||
|
||||
foreach (var unit in allies)
|
||||
{
|
||||
var team = unit.GetComponent<UnitTeam>();
|
||||
if (team != null && team.teamId == 0) // 友方
|
||||
{
|
||||
var healthBar = unit.GetComponent<WorldHealthBar>();
|
||||
if (healthBar != null)
|
||||
{
|
||||
healthBar.maxHealth *= healthMultiplier;
|
||||
healthBar.currentHealth *= healthMultiplier;
|
||||
buffedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"全局生命增益:{buffedCount} 个友方单位生命值提升 {(healthMultiplier - 1) * 100}%");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user