```
feat(Animation): 添加技能动画状态和过渡 - 在base人类型士控制器中添加skill动画状态 - 添加从默认状态到技能状态的过渡条件 - 配置技能动画的状态转换参数 - 在蓝色怪物override controller中添加技能动画覆盖 fix(Model): 修复模型导入设置和骨骼位置 - 将人类型士Idle模型材质导入模式从2改为1 - 调整蓝色怪物怒吼动画的最后一帧从85到65 - 修正模型骨骼位置数据,统一缩放比例 - 更新蓝色怪物模型的全局缩放从0.023到2.3 docs(Codely): 删除剪贴板图片文件 ```
This commit is contained in:
1 parent
2728c1d2cc
commit
21aceb6c04
44 files changed
+23820
-173
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ArcherHunterSkill : UnitSkill
|
||||
{
|
||||
[Min(0f)]
|
||||
public float splitShotRadius = 3f;
|
||||
|
||||
public override void ReleaseSkill()
|
||||
{
|
||||
GameObject mainTarget = unit.Target;
|
||||
if (mainTarget == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject nearbyOpponent = FindNearbyOpponent(mainTarget);
|
||||
unit.FireSkillProjectile(nearbyOpponent != null ? nearbyOpponent : mainTarget);
|
||||
}
|
||||
|
||||
private GameObject FindNearbyOpponent(GameObject mainTarget)
|
||||
{
|
||||
string opponentTag = unit.OpponentTag;
|
||||
if (string.IsNullOrEmpty(opponentTag))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject nearbyOpponent = null;
|
||||
float nearestSqrDistance = splitShotRadius * splitShotRadius;
|
||||
GameObject[] opponents = GameObject.FindGameObjectsWithTag(opponentTag);
|
||||
foreach (GameObject opponent in opponents)
|
||||
{
|
||||
if (opponent == mainTarget || opponent == unit.gameObject || opponent.transform.root == unit.transform.root)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float sqrDistance = (opponent.transform.position - mainTarget.transform.position).sqrMagnitude;
|
||||
if (sqrDistance <= nearestSqrDistance)
|
||||
{
|
||||
nearestSqrDistance = sqrDistance;
|
||||
nearbyOpponent = opponent;
|
||||
}
|
||||
}
|
||||
|
||||
return nearbyOpponent;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user