2026-06-12 17:11:39 -04:00
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
using Cielonos.MainGame.Effects.Feedback;
|
2026-07-18 03:16:20 -04:00
|
|
|
using SLSUtilities.General;
|
2026-06-12 17:11:39 -04:00
|
|
|
using UnityEngine;
|
2026-06-13 18:43:40 -04:00
|
|
|
using Random = UnityEngine.Random;
|
2026-06-12 17:11:39 -04:00
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame.Inventory.Collections
|
|
|
|
|
{
|
|
|
|
|
public partial class Polychrome
|
|
|
|
|
{
|
|
|
|
|
private NormalArea CreateBaseSlash(string vfxName, AttackUnit attackUnit, float timeDuration = 1f, float hitActiveDuration = 0.04f)
|
|
|
|
|
{
|
|
|
|
|
NormalArea slash = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
2026-07-18 03:16:20 -04:00
|
|
|
|
|
|
|
|
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
|
|
|
|
.SetAttackSubmodule<NormalArea>(attackUnit)
|
|
|
|
|
.SetTimeSubmodule<NormalArea>(timeDuration, hitActiveDuration, 0.04f)
|
|
|
|
|
.SetHitSubmodule<NormalArea>();
|
|
|
|
|
|
|
|
|
|
return slash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private NormalArea GenerateFarSlash(string vfxName, AttackUnit attackUnit, Enemy target)
|
|
|
|
|
{
|
|
|
|
|
NormalArea slash = target != null
|
|
|
|
|
? vfxData.SpawnVFX(vfxName, player, target.CenterPoint).GetComponentInChildren<NormalArea>()
|
|
|
|
|
: vfxData.SpawnVFX(vfxName, player, player.transform, new Vector3(0, 1.5f, 3f)).GetComponentInChildren<NormalArea>();
|
|
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
|
|
|
|
.SetAttackSubmodule<NormalArea>(attackUnit)
|
2026-07-18 03:16:20 -04:00
|
|
|
.SetTimeSubmodule<NormalArea>(1f, 0.04f, 0.04f)
|
2026-06-12 17:11:39 -04:00
|
|
|
.SetHitSubmodule<NormalArea>();
|
2026-07-18 03:16:20 -04:00
|
|
|
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_LIGHTATTACKHIT);
|
|
|
|
|
Vector3 hitShakeAmplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * 0.12f;
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_HitShakeFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
2026-06-12 17:11:39 -04:00
|
|
|
{
|
2026-07-18 03:16:20 -04:00
|
|
|
if (!result.HasOutcome(Attack.Outcome.Hit)) return;
|
|
|
|
|
PlayHitShakeFeedback("HeavyHit", hitShakeAmplitude);
|
|
|
|
|
}));
|
2026-06-12 17:11:39 -04:00
|
|
|
return slash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private NormalArea GenerateNormalSlash(string vfxName, AttackUnit attackUnit, string hitFeedback)
|
|
|
|
|
{
|
|
|
|
|
NormalArea slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.02f);
|
|
|
|
|
slash.SetImpulseSubmodule().WithRepulsion(2f);
|
2026-07-18 03:16:20 -04:00
|
|
|
|
|
|
|
|
float magnitude = hitFeedback == "SingleNormalHit" ? 0.08f : 0.04f;
|
|
|
|
|
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_LIGHTATTACKHIT);
|
|
|
|
|
Vector3 hitShakeAmplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * magnitude;
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_HitShakeFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
|
|
|
|
{
|
|
|
|
|
if (!result.HasOutcome(Attack.Outcome.Hit)) return;
|
|
|
|
|
PlayHitShakeFeedback(hitFeedback, hitShakeAmplitude);
|
|
|
|
|
}));
|
|
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
return slash;
|
|
|
|
|
}
|
2026-07-18 03:16:20 -04:00
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
private NormalArea GenerateHeavySlash(string vfxName, AttackUnit attackUnit)
|
|
|
|
|
{
|
|
|
|
|
NormalArea slash;
|
2026-07-18 03:16:20 -04:00
|
|
|
if (_hasPhotonDissociator)
|
|
|
|
|
{
|
|
|
|
|
slash = CreatePhotonDissociatorHeavySlash(vfxName, attackUnit);
|
|
|
|
|
}
|
|
|
|
|
else
|
2026-06-12 17:11:39 -04:00
|
|
|
{
|
|
|
|
|
slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.04f);
|
2026-07-01 06:32:50 -04:00
|
|
|
slash.SetImpulseSubmodule(1f).WithRepulsion(5f);
|
2026-06-12 17:11:39 -04:00
|
|
|
}
|
2026-07-18 03:16:20 -04:00
|
|
|
|
|
|
|
|
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT);
|
|
|
|
|
Vector3 hitShakeAmplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * 0.16f;
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_HitShakeFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
2026-06-12 17:11:39 -04:00
|
|
|
{
|
2026-07-18 03:16:20 -04:00
|
|
|
if (!result.HasOutcome(Attack.Outcome.Hit)) return;
|
|
|
|
|
PlayHitShakeFeedback("HeavyHit", hitShakeAmplitude);
|
|
|
|
|
}));
|
|
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
return slash;
|
|
|
|
|
}
|
2026-07-18 03:16:20 -04:00
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
private NormalArea GenerateDisruptionSlash(string vfxName, AttackUnit attackUnit)
|
|
|
|
|
{
|
|
|
|
|
NormalArea slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.04f);
|
|
|
|
|
slash.SetImpulseSubmodule().WithRepulsion(5f);
|
|
|
|
|
|
2026-07-18 03:16:20 -04:00
|
|
|
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT);
|
|
|
|
|
Vector3 hitShakeAmplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * 0.16f;
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_HitShakeFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
2026-06-12 17:11:39 -04:00
|
|
|
{
|
2026-07-18 03:16:20 -04:00
|
|
|
if (!result.HasOutcome(Attack.Outcome.Hit)) return;
|
|
|
|
|
PlayHitShakeFeedback("HeavyHit", hitShakeAmplitude);
|
|
|
|
|
}));
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_BreakthroughFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
|
|
|
|
{
|
|
|
|
|
if (!result.HasOutcome(Attack.Outcome.Breakthrough)) return;
|
2026-06-12 17:11:39 -04:00
|
|
|
feedbackSc.PlayFeedback("Breakthrough");
|
2026-07-18 03:16:20 -04:00
|
|
|
}));
|
2026-06-12 17:11:39 -04:00
|
|
|
return slash;
|
|
|
|
|
}
|
2026-07-18 03:16:20 -04:00
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
private NormalArea GenerateUltimateSlash(string vfxName, AttackUnit attackUnit)
|
|
|
|
|
{
|
2026-06-13 18:43:40 -04:00
|
|
|
NormalArea slash = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
2026-07-18 03:16:20 -04:00
|
|
|
|
2026-06-13 18:43:40 -04:00
|
|
|
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
|
|
|
|
.SetAttackSubmodule<NormalArea>(attackUnit)
|
2026-06-30 01:48:58 -04:00
|
|
|
.SetTimeSubmodule<NormalArea>(2f, 0.02f, 0.24f)
|
2026-06-13 18:43:40 -04:00
|
|
|
.SetHitSubmodule<NormalArea>(0.07f, 3);
|
2026-07-18 03:16:20 -04:00
|
|
|
|
|
|
|
|
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT);
|
|
|
|
|
Vector3 hitShakeAmplitude = new Vector3(Random.value, Random.value, Random.value).normalized * 0.16f;
|
|
|
|
|
slash.eventSm.onAttackFinished.Add("Polychrome_HitShakeFeedback", new PrioritizedAction<CharacterBase, Attack.Result>((_, result) =>
|
|
|
|
|
{
|
|
|
|
|
if (result.HasOutcome(Attack.Outcome.Hit))
|
2026-06-12 17:11:39 -04:00
|
|
|
{
|
2026-07-18 03:16:20 -04:00
|
|
|
PlayHitShakeFeedback("UltimateAttackHit", hitShakeAmplitude);
|
|
|
|
|
Debug.Log($"Ultimate Slash finished");
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
|
2026-06-12 17:11:39 -04:00
|
|
|
return slash;
|
|
|
|
|
}
|
2026-07-18 03:16:20 -04:00
|
|
|
|
|
|
|
|
private void PlayHitShakeFeedback(string feedbackName, Vector3 amplitude)
|
|
|
|
|
{
|
|
|
|
|
feedbackSc.PlayFeedback(feedbackName, runtimeFeedback =>
|
|
|
|
|
{
|
|
|
|
|
CameraPositionShakeAction positionShakeAction = runtimeFeedback.Action<CameraPositionShakeAction>("Camera");
|
|
|
|
|
if (positionShakeAction != null)
|
|
|
|
|
{
|
|
|
|
|
positionShakeAction.amplitude = amplitude;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-06-12 17:11:39 -04:00
|
|
|
}
|
|
|
|
|
}
|