Files
SoulliesOfficial 649b7a5ddc 更新
2026-05-23 08:27:50 -04:00

113 lines
4.5 KiB
C#

using Cielonos.MainGame.Inventory;
using Cielonos.MainGame.UI;
using SLSUtilities.FunctionalAnimation;
using SLSUtilities.WwiseAssistance;
namespace Cielonos.MainGame.Characters
{
public partial class L1_Assault_Pawn : Enemy
{
protected override void Start()
{
base.Start();
PlayerCanvas.EnemyInfoUIArea.CreateInfoUnit(this);
animationSc.registeredFunctions.Add("DodgeStart", anim => DodgeStart());
animationSc.registeredFunctions.Add("DodgeEnd", anim => DodgeEnd());
animationSc.registeredFunctions.Add("SetBlock", anim => SetBlock());
animationSc.registeredFunctions.Add("StayBlocking", anim => StayBlocking());
animationSc.registeredFunctions.Add("RemoveBlock", anim => RemoveBlock());
}
}
public partial class L1_Assault_Pawn
{
private void FAPF_GeneratePunch(RuntimeFuncAnim rtFuncAnim)
{
CustomFunction.PC_StringString p = rtFuncAnim.GetParams<CustomFunction.PC_StringString>();
GeneratePunch(p.str0, attackData[p.str1]);
}
}
public partial class L1_Assault_Pawn
{
private NormalArea GeneratePunch(string vfxName, AttackUnit attackUnit)
{
NormalArea punch = vfxData.SpawnVFX(vfxName, this, transform).GetComponentInChildren<NormalArea>();
punch.Initialize<NormalArea>(this, Fraction.Player)
.SetAttackSubmodule<NormalArea>(attackUnit)
.SetTimeSubmodule<NormalArea>(1f)
.SetHitSubmodule<NormalArea>();
punch.SetImpulseSubmodule().WithCustomForce(transform.forward);
punch.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_LIGHTATTACKHIT);
return punch;
}
private void DodgeStart()
{
movementSc.isDashing = true;
DodgeSource defaultDodge = DodgeSource.Default(this);
reactionSc.dodgeSm.ApplyDodge(defaultDodge);
}
private void DodgeEnd()
{
movementSc.isDashing = false;
movementSc.dashMoveMultiplier = 1;
reactionSc.dodgeSm.RemoveDodge("DefaultDodge");
}
private void SetBlock(BlockData blockData = null)
{
blockData ??= this.blockData;
BlockSource blockSource = blockData.CreateBlockSource(this);
if (reactionSc.blockSm.HaveBlockSource(blockSource.blockName))
{
return;
}
movementSc.canDash = false;
movementSc.canDodge = false;
//behaviorTree.SetVariableValue("DefenseType", "Block");
blockSource.onNormalBlock = (attackArea) =>
{
AudioManager.Post(AK.EVENTS.POLYCHROME_NORMALBLOCK, centerPosition);
attackArea.creator.movementSc.impulseSm.ApplyImpulse(-attackArea.creator.transform.forward * 10f);
attackArea.creator.GetHit(Breakthrough.Type.Disruption, out _);
//blockAnimName = blockAnimName == "BlockL" ? "BlockR" : "BlockL";
//animationSc.fullBodyFuncAnimSm.Play(blockAnimName, 1, 0);
//player.selfTimeSm.ModifyTimeScale(0.06f, 0.4f);
//attackArea.creator.selfTimeSm.ModifyTimeScale(0.06f, 0.4f);
};
blockSource.onPerfectBlock = (attackArea) =>
{
AudioManager.Post(AK.EVENTS.POLYCHROME_PERFECTBLOCK, centerPosition);
attackArea.creator.movementSc.impulseSm.ApplyImpulse(-attackArea.creator.transform.forward * 10f);
attackArea.creator.GetHit(Breakthrough.Type.Disruption, out _);
//blockAnimName = blockAnimName == "BlockL" ? "BlockR" : "BlockL";
//animationSc.fullBodyFuncAnimSm.Play(blockAnimName, 1, 0);
//player.selfTimeSm.ModifyTimeScale(0.12f, EaseType.InQuint, 0.2f);
//attackArea.creator.selfTimeSm.ModifyTimeScale(0.12f, EaseType.InQuint, 0.2f);
};
reactionSc.blockSm.ApplyBlock(blockSource);
}
private void StayBlocking()
{
}
private void RemoveBlock(BlockData blockData = null)
{
blockData ??= this.blockData;
movementSc.canDash = true;
movementSc.canDodge = true;
/*selfTimeSm.AddLocalTimer(5f, ()=>behaviorTree.SetVariableValue("DefenseType", "Dodge"));*/
reactionSc.blockSm.RemoveBlock(blockData.blockName);
}
}
}