Files
Cielonos/Assets/Scripts/MainGame/Items/MainWeapons/Polychrome/Polychrome.cs

81 lines
2.6 KiB
C#
Raw Normal View History

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