更新
This commit is contained in:
32
Assets/Scripts/MainGame/Items/Consumables/AutomaticShield.cs
Normal file
32
Assets/Scripts/MainGame/Items/Consumables/AutomaticShield.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Inventory.Collections
|
||||
{
|
||||
public class AutomaticShield : ConsumableBase
|
||||
{
|
||||
public override void OnObtained()
|
||||
{
|
||||
base.OnObtained();
|
||||
player.eventSm.onBeforeGetAttacked.Add("AutomaticShield", new PrioritizedAction<AttackAreaBase>(CheckAndEffect));
|
||||
}
|
||||
|
||||
public override void OnDiscarded()
|
||||
{
|
||||
base.OnDiscarded();
|
||||
player.eventSm.onBeforeGetAttacked.Remove("AutomaticShield");
|
||||
}
|
||||
|
||||
void CheckAndEffect(AttackAreaBase attackArea)
|
||||
{
|
||||
if (attackArea.attackSm.attackUnit.startDamage > 1f)
|
||||
{
|
||||
if (Use(1))
|
||||
{
|
||||
attackArea.attackSm.attackValue.damage = 0f;
|
||||
CameraEffectManager.Instance.vignetteEffects["Shield"].mainEffect.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user