```
docs(clipboard): 添加剪贴板功能相关图片资源 添加了两个剪贴板功能的截图文件,用于文档说明和功能展示。 ```
This commit is contained in:
1 parent
47f01ecd2e
commit
f93d69d8ee
77 files changed
+5482
-307
No files matched your search
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CastleMageSkill : UnitSkill
|
||||
{
|
||||
[Header("小型魔爆参数")]
|
||||
[Min(0.1f)]
|
||||
public float explosionRadius = 1.8f;
|
||||
|
||||
[Min(0f)]
|
||||
public float explosionDamage = 85f;
|
||||
|
||||
public override void ReleaseSkill()
|
||||
{
|
||||
GameObject target = unit.Target;
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string opponentTag = unit.OpponentTag;
|
||||
if (string.IsNullOrEmpty(opponentTag))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 center = target.transform.position;
|
||||
float radiusSquared = explosionRadius * explosionRadius;
|
||||
HashSet<UnitBase> hitUnits = new HashSet<UnitBase>();
|
||||
|
||||
foreach (GameObject opponent in GameObject.FindGameObjectsWithTag(opponentTag))
|
||||
{
|
||||
if (opponent == null || opponent.transform.root == unit.transform.root)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector3 offset = opponent.transform.position - center;
|
||||
offset.y = 0f;
|
||||
if (offset.sqrMagnitude > radiusSquared)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UnitBase targetUnit = opponent.GetComponentInParent<UnitBase>();
|
||||
if (targetUnit != null && hitUnits.Add(targetUnit))
|
||||
{
|
||||
targetUnit.ReceiveDamage(explosionDamage, unit.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user