根据提供的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,49 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class ArcherSkill : UnitSkill
|
||||
{
|
||||
[Min(1)]
|
||||
public int volleyArrowCount = 3;
|
||||
|
||||
[Min(0f)]
|
||||
public float volleyArrowDamageMultiplier = 0.7f;
|
||||
|
||||
[Min(0f)]
|
||||
public float volleyArrowInterval = 0.15f;
|
||||
|
||||
private Coroutine volleyCoroutine;
|
||||
|
||||
public override void ReleaseSkill()
|
||||
{
|
||||
if (volleyCoroutine != null)
|
||||
{
|
||||
StopCoroutine(volleyCoroutine);
|
||||
}
|
||||
|
||||
volleyCoroutine = StartCoroutine(FireVolley());
|
||||
}
|
||||
|
||||
private IEnumerator FireVolley()
|
||||
{
|
||||
for (int i = 0; i < volleyArrowCount; i++)
|
||||
{
|
||||
// 三连射优先攻击当前目标;目标阵亡后剩余箭矢改打最近敌人。
|
||||
GameObject volleyTarget = unit.Target != null ? unit.Target : FindNearestOpponent();
|
||||
if (volleyTarget == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
unit.FireSkillProjectile(volleyTarget, volleyArrowDamageMultiplier);
|
||||
yield return new WaitForSeconds(volleyArrowInterval);
|
||||
}
|
||||
|
||||
volleyCoroutine = null;
|
||||
}
|
||||
|
||||
private GameObject FindNearestOpponent()
|
||||
{
|
||||
return unit.FindNearestEnemyForSkill();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user