128 lines
5.1 KiB
C#
128 lines
5.1 KiB
C#
using Cielonos.MainGame.Buffs.Character;
|
|
using Cielonos.MainGame.Characters.Inventory;
|
|
using Cielonos.MainGame.UI;
|
|
using SLSUtilities.FunctionalAnimation;
|
|
using SLSUtilities.General;
|
|
using SLSUtilities.WwiseAssistance;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
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());
|
|
}
|
|
|
|
protected override void InitializeSubmodules()
|
|
{
|
|
base.InitializeSubmodules();
|
|
selfTimeSm.coolDownTimers["Attack"] = new Timer(5f);
|
|
selfTimeSm.coolDownTimers["NormalAttack"] = new Timer(5f);
|
|
selfTimeSm.coolDownTimers["Action"] = new Timer(4f);
|
|
selfTimeSm.coolDownTimers["Dodge"] = new Timer(5f);
|
|
selfTimeSm.coolDownTimers["Block"] = new Timer(5f);
|
|
}
|
|
|
|
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");
|
|
}
|
|
}
|
|
|
|
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).GetComponentInChildren<NormalArea>();
|
|
|
|
punch.Initialize<NormalArea>(this, Fraction.Enemy)
|
|
.SetAttackSubmodule<NormalArea>(attackUnit)
|
|
.SetTimeSubmodule<NormalArea>(1f)
|
|
.SetHitSubmodule<NormalArea>()
|
|
.SetForceSubmodule<NormalArea>(transform.forward);
|
|
punch.hitSm.AddHitSound(AK.EVENTS.POLYCHROME_LIGHTATTACKHIT);
|
|
return punch;
|
|
}
|
|
|
|
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.additionalForceSm.AddForce(-attackArea.creator.transform.forward * 10f);
|
|
attackArea.creator.GetHit(BreakthroughType.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.additionalForceSm.AddForce(-attackArea.creator.transform.forward * 10f);
|
|
attackArea.creator.GetHit(BreakthroughType.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);
|
|
}
|
|
}
|
|
} |