62 lines
2.3 KiB
C#
62 lines
2.3 KiB
C#
using Cielonos.MainGame.Buffs.Character;
|
|
using Cielonos.MainGame.Characters;
|
|
using Cielonos.MainGame.UI;
|
|
using SLSUtilities.FunctionalAnimation;
|
|
using SLSUtilities.General;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Inventory.Collections
|
|
{
|
|
public partial class VoidAnchor : SupportEquipmentBase
|
|
{
|
|
public override void OnPress()
|
|
{
|
|
if (functionSm.mainFunction.IsAvailable())
|
|
{
|
|
CharacterBase enemy = CombatManager.EnemySm.GetNearestEnemy(50f);
|
|
if (enemy != null)
|
|
{
|
|
Vector3 vector = (enemy.centerPosition - player.centerPosition).Flatten();
|
|
float distance = vector.magnitude - enemy.collisionSc.mainColliderRadius - 1f;
|
|
distance = Mathf.Max(distance, 0f);
|
|
Vector3 direction = vector.normalized;
|
|
|
|
player.animationSc.SetupDash(direction, false, distance);
|
|
}
|
|
else
|
|
{
|
|
player.animationSc.SetupDash(player.transform.forward, false, -1f);
|
|
}
|
|
|
|
player.eventSm.onDashEnd.Add("VoidAnchor", new PrioritizedAction(() => GenerateArea("WeakArea"), 0 , 1));
|
|
|
|
functionSm.mainFunction.Execute();
|
|
PlayerCanvas.SupportEquipmentsUIArea[this].UseOutlineAnimation();
|
|
}
|
|
else
|
|
{
|
|
PlayerCanvas.SupportEquipmentsUIArea[this].CanNotUseOutlineAnimation();
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class VoidAnchor
|
|
{
|
|
private void GenerateArea(string vfxName)
|
|
{
|
|
NormalArea weakArea = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
|
|
|
weakArea.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
|
.SetAttackSubmodule<NormalArea>(attackData[vfxName])
|
|
.SetTimeSubmodule<NormalArea>(3f, 0.25f)
|
|
.SetHitSubmodule<NormalArea>();
|
|
weakArea.SetImpulseSubmodule().WithDynamicForce(10f);
|
|
|
|
weakArea.hitSm.AddHitEvent((hitTarget, hitPosition) =>
|
|
{
|
|
new Weak(30).Apply(hitTarget);
|
|
hitTarget.GetHit(Breakthrough.Type.Forced, out _, DisruptionType.ForcedExternal);
|
|
});
|
|
}
|
|
}
|
|
} |