123
This commit is contained in:
1 parent
2241642a97
commit
4216d27310
132 files changed
+3575
-137
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ShieldGuardSkill : UnitSkill
|
||||
{
|
||||
[Header("盾牌参数")]
|
||||
[Min(1f)]
|
||||
public float shieldDurability = 220f;
|
||||
|
||||
[Min(0.1f)]
|
||||
public float shieldDuration = 6f;
|
||||
|
||||
public Vector3 shieldLocalPosition = new Vector3(0f, 1f, 0.7f);
|
||||
|
||||
public Vector3 shieldSize = new Vector3(1.5f, 1.8f, 0.12f);
|
||||
|
||||
private ShieldBarrier shield;
|
||||
|
||||
public ShieldBarrier ActiveShield => shield;
|
||||
|
||||
public override void ReleaseSkill()
|
||||
{
|
||||
EnsureShield();
|
||||
shield.Refresh(shieldDurability, shieldDuration, shieldLocalPosition, shieldSize);
|
||||
}
|
||||
|
||||
private void EnsureShield()
|
||||
{
|
||||
if (shield != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject shieldObject = new GameObject("ShieldBarrier");
|
||||
shieldObject.transform.SetParent(unit.transform, false);
|
||||
|
||||
BoxCollider boxCollider = shieldObject.AddComponent<BoxCollider>();
|
||||
boxCollider.isTrigger = true;
|
||||
boxCollider.size = shieldSize;
|
||||
|
||||
shield = shieldObject.AddComponent<ShieldBarrier>();
|
||||
shield.Configure(unit, boxCollider);
|
||||
shieldObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user