Files
Cielonos/Assets/Scripts/MainGame/Items/MainWeapons/Polychrome/Polychrome_Block.cs
SoulliesOfficial 6d7ebc5825 Passion & UI
2026-06-12 17:11:39 -04:00

72 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Cielonos.MainGame.Characters;
using Cielonos.MainGame.Effects.Feedback;
using UnityEngine;
namespace Cielonos.MainGame.Inventory.Collections
{
public partial class Polychrome
{
public BlockData equipBlockData;
private string _blockAnimName = "BlockL";
private void PlayBlockReaction(string feedbackName, float amplitudeScale)
{
_blockAnimName = _blockAnimName == "BlockL" ? "BlockR" : "BlockL";
animationSc.fullBodyFuncAnimSm.Play(_blockAnimName, 1, 0);
var rotationShakeAction = feedbackSc.GetFeedbackData(feedbackName).Action<CameraRotationShakeAction>("Camera");
Vector3 baseAmplitude = _blockAnimName == "BlockL" ? new Vector3(0f, -2f, 1f) : new Vector3(0f, 2f, -1f);
rotationShakeAction.amplitude = baseAmplitude * amplitudeScale;
feedbackSc.PlayFeedback(feedbackName);
}
private void SetBlock(BlockData blockData = null)
{
blockData ??= this.blockData;
BlockSource blockSource = blockData.CreateBlockSource(player, this);
player.landMovementSc.canDash = false;
player.landMovementSc.canDodge = false;
blockSource.onNormalBlock = (attackArea) =>
{
PlayBlockReaction("NormalBlock", 1f);
};
blockSource.onPerfectBlock = (attackArea) =>
{
PlayBlockReaction("PerfectBlock", 2f);
if (attackArea is NormalArea)
{
if (HasExtender<PhotonPolarizer>()) // 如果有Photon Polarizer完美格挡会弹开并打断敌人
{
attackArea.creator.GetHit(Breakthrough.Type.Forced, out _);
attackArea.creator.movementSc.impulseSm.ApplyKnockback(player.transform.forward, 6f);
}
}
};
player.reactionSc.blockSm.ApplyBlock(blockSource);
}
private void StayBlocking()
{
if (player.inputSc.IsHoldingSpecialB)
{
player.movementSc.canMove.Modify(true);
player.movementSc.canRotate.Modify(true);
OnSpecialBPress();
}
}
private void RemoveBlock(BlockData blockData = null)
{
blockData ??= this.blockData;
player.landMovementSc.canDash = true;
player.landMovementSc.canDodge = true;
player.reactionSc.blockSm.RemoveBlock(blockData.blockName);
}
}
}