134 lines
5.8 KiB
C#
134 lines
5.8 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using ChocDino.UIFX;
|
||
using Cielonos.MainGame.Buffs.Character;
|
||
using Cielonos.MainGame.Characters;
|
||
using Cielonos.MainGame.Effects.Feedback;
|
||
using Cielonos.MainGame.UI;
|
||
using SLSUtilities.Feedback;
|
||
using SLSUtilities.General;
|
||
using SLSUtilities.FunctionalAnimation;
|
||
using SLSUtilities.WwiseAssistance;
|
||
using UnityEngine;
|
||
using Random = UnityEngine.Random;
|
||
|
||
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>();
|
||
|
||
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
||
.SetAttackSubmodule<NormalArea>(attackUnit)
|
||
.SetTimeSubmodule<NormalArea>(timeDuration, hitActiveDuration)
|
||
.SetHitSubmodule<NormalArea>();
|
||
|
||
slash.attackSm.breakthroughAction = (enemy, hitPosition) =>
|
||
{
|
||
AudioManager.Post(AK.EVENTS.DISRUPT, hitPosition);
|
||
};
|
||
|
||
return slash;
|
||
}
|
||
|
||
private NormalArea GenerateNormalSlash(string vfxName, AttackUnit attackUnit, string hitFeedback)
|
||
{
|
||
NormalArea slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.02f);
|
||
slash.SetImpulseSubmodule().WithRepulsion(2f);
|
||
|
||
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_LIGHTATTACKHIT)
|
||
.AddHitEvent((enemy, hitPosition) =>
|
||
{
|
||
var positionShakeAction = feedbackSc.GetFeedbackData(hitFeedback).Action<CameraPositionShakeAction>("Camera");
|
||
float magnitude = hitFeedback == "SingleNormalHit" ? 0.12f : 0.06f;
|
||
positionShakeAction.amplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * magnitude;
|
||
feedbackSc.PlayFeedback(hitFeedback);
|
||
});
|
||
|
||
return slash;
|
||
}
|
||
|
||
private NormalArea GenerateHeavySlash(string vfxName, AttackUnit attackUnit)
|
||
{
|
||
NormalArea slash;
|
||
if (!HasExtender<PhotonDissociator>())
|
||
{
|
||
slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.04f);
|
||
}
|
||
else // 如果有Photon Dissociator,重攻击拆分为五段,每段伤害为原来的30%,时间和判定也相应调整
|
||
{
|
||
AttackUnit modifiedUnit = attackUnit.Clone();
|
||
modifiedUnit.startDamage *= 0.5f;
|
||
|
||
slash = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
||
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
||
.SetAttackSubmodule<NormalArea>(modifiedUnit)
|
||
.SetTimeSubmodule<NormalArea>(1f, 0.04f, 0.4f)
|
||
.SetHitSubmodule<NormalArea>(0.1f, 3);
|
||
|
||
slash.attackSm.breakthroughAction = (enemy, hitPosition) =>
|
||
{
|
||
AudioManager.Post(AK.EVENTS.DISRUPT, hitPosition);
|
||
};
|
||
}
|
||
|
||
slash.SetImpulseSubmodule(1f).WithRepulsion(5f);
|
||
|
||
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT)
|
||
.AddHitEvent((enemy, hitPosition) =>
|
||
{
|
||
var positionShakeAction = feedbackSc.GetFeedbackData("HeavyHit").Action<CameraPositionShakeAction>("Camera");
|
||
positionShakeAction.amplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * 0.18f;
|
||
feedbackSc.PlayFeedback("HeavyHit");
|
||
});
|
||
|
||
return slash;
|
||
}
|
||
|
||
private NormalArea GenerateDisruptionSlash(string vfxName, AttackUnit attackUnit)
|
||
{
|
||
NormalArea slash = CreateBaseSlash(vfxName, attackUnit, 1f, 0.04f);
|
||
slash.SetImpulseSubmodule().WithRepulsion(5f);
|
||
|
||
slash.attackSm.breakthroughAction = (enemy, hitPosition) =>
|
||
{
|
||
feedbackSc.PlayFeedback("Breakthrough");
|
||
AudioManager.Post(AK.EVENTS.DISRUPT, hitPosition);
|
||
};
|
||
|
||
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT)
|
||
.AddHitEvent((enemy, hitPosition) =>
|
||
{
|
||
var positionShakeAction = feedbackSc.GetFeedbackData("HeavyHit").Action<CameraPositionShakeAction>("Camera");
|
||
positionShakeAction.amplitude = vfxData.Get(vfxName).slashScreenPosition.normalized * 0.18f;
|
||
feedbackSc.PlayFeedback("HeavyHit");
|
||
});
|
||
return slash;
|
||
}
|
||
|
||
private NormalArea GenerateUltimateSlash(string vfxName, AttackUnit attackUnit)
|
||
{
|
||
NormalArea slash = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
||
|
||
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
||
.SetAttackSubmodule<NormalArea>(attackUnit)
|
||
.SetTimeSubmodule<NormalArea>(2f, 0f, 0.22f)
|
||
.SetHitSubmodule<NormalArea>(0.07f, 3);
|
||
|
||
slash.SetImpulseSubmodule(1f).WithRepulsion(5f);
|
||
|
||
slash.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_HEAVYATTACKLHIT)
|
||
.AddHitEvent((enemy, hitPosition) =>
|
||
{
|
||
var positionShakeAction = feedbackSc.GetFeedbackData("UltimateAttackHit").Action<CameraPositionShakeAction>("Camera");
|
||
positionShakeAction.amplitude = new Vector3(Random.value, Random.value, Random.value).normalized * 0.18f;
|
||
feedbackSc.PlayFeedback("UltimateAttackHit");
|
||
});
|
||
|
||
return slash;
|
||
}
|
||
}
|
||
}
|