Files
Cielonos/Assets/Scripts/MainGame/Items/MainWeapons/Polychrome/Polychrome.cs
SoulliesOfficial 39b43680a9 爆更
2026-07-18 03:16:20 -04:00

81 lines
2.6 KiB
C#

using System.Collections.Generic;
using Cielonos.MainGame.Characters;
using Cielonos.MainGame.UI;
using SLSUtilities.General;
using UnityEngine.InputSystem;
namespace Cielonos.MainGame.Inventory.Collections
{
public partial class Polychrome : MainWeaponBase
{
private bool _canAirLightAttack;
private bool _canAirHeavyAttack;
private Enemy _farSlashTarget;
protected override void Update()
{
base.Update();
if (Keyboard.current.cKey.wasPressedThisFrame)
{
SetBlock(blockData, true);
player.reactionSc.blockSm.GetBlockSource("Polychrome_Block").NormalBlock(null, player.CenterPosition + player.transform.forward);
RemoveBlock();
}
if (Keyboard.current.xKey.wasPressedThisFrame)
{
SetBlock(blockData, true);
player.reactionSc.blockSm.GetBlockSource("Polychrome_Block").PerfectBlock(null, player.CenterPosition + player.transform.forward);
RemoveBlock();
}
if (Keyboard.current.zKey.wasPressedThisFrame)
{
player.reactionSc.dodgeSm.ApplyDodge(DodgeSource.Default(player));
player.reactionSc.dodgeSm.GetCurrentDodgeSource()?.PerfectDodge(null);
player.reactionSc.dodgeSm.RemoveDodge("DefaultDodge");
}
}
public override void OnEquipped()
{
base.OnEquipped();
CacheExtenderFlags();
_currentKatanaParticle = string.Empty;
player.eventSm.onFirstJump.TryAdd(nameof(Polychrome), new PrioritizedAction(() =>
{
_canAirLightAttack = true;
_canAirHeavyAttack = true;
comboSm["AirLight"].Reset();
}));
CombatManager.PassionSystem.OnLevelChanged += OnPassionLevelChanged;
RegisterFunctionsToAnimSc(StayBlocking);
viewObjects["Katana"].SetFadeAnim(0.2f);
viewObjects["Saya"].SetFadeAnim(0.2f);
CacheKatanaParticles();
UpdateViewObjectVisuals();
}
public override void OnUnequipped()
{
base.OnUnequipped();
ClearKatanaParticleCache();
CombatManager.PassionSystem.OnLevelChanged -= OnPassionLevelChanged;
player.eventSm.onFirstJump.Remove(nameof(Polychrome));
}
private void OnPassionLevelChanged(int oldLevel, int newLevel)
{
UpdateViewObjectVisuals();
}
}
}