2026-05-10 11:47:55 -04:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
using SLSUtilities.General;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
namespace Cielonos.MainGame.Inventory.Collections
|
2026-05-10 11:47:55 -04:00
|
|
|
{
|
|
|
|
|
public partial class FutureWand : MainWeaponBase
|
|
|
|
|
{
|
|
|
|
|
private bool _isHoldingAttack;
|
|
|
|
|
|
|
|
|
|
public CharacterBase currentTarget;
|
2026-06-27 12:52:03 -04:00
|
|
|
|
|
|
|
|
private NormalArea _activeSpinArea;
|
|
|
|
|
|
|
|
|
|
private Transform Muzzle => viewObjects["Wand"].functionalParts["Muzzle"].transform;
|
|
|
|
|
|
2026-05-10 11:47:55 -04:00
|
|
|
public override void OnEquipped()
|
|
|
|
|
{
|
|
|
|
|
base.OnEquipped();
|
|
|
|
|
RegisterFunctionsToAnimSc();
|
|
|
|
|
viewObjects["Wand"].SetFadeAnim(0.5f);
|
2026-06-27 12:52:03 -04:00
|
|
|
|
|
|
|
|
// 订阅玩家受击事件,在受击时中断施法并召回 SpinArea
|
|
|
|
|
player.eventSm.onGetHit.TryAdd(nameof(FutureWand), new PrioritizedAction<AttackAreaBase>(OnPlayerGetHit));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnUnequipped()
|
|
|
|
|
{
|
|
|
|
|
// 注销受击事件,避免内存泄漏
|
|
|
|
|
player.eventSm.onGetHit.Remove(nameof(FutureWand));
|
|
|
|
|
|
|
|
|
|
RecallActiveSpinArea();
|
|
|
|
|
base.OnUnequipped();
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
2026-06-12 17:11:39 -04:00
|
|
|
|
|
|
|
|
public override void OnSwitchIn()
|
|
|
|
|
{
|
|
|
|
|
if(!player.inputSc.IsMoving) PlayTargetedAnimation("Equip");
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-27 12:52:03 -04:00
|
|
|
public override void OnSwitchOut()
|
|
|
|
|
{
|
|
|
|
|
base.OnSwitchOut();
|
|
|
|
|
RecallActiveSpinArea();
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-10 11:47:55 -04:00
|
|
|
public override void OnPrimaryPress()
|
|
|
|
|
{
|
|
|
|
|
if (!_isHoldingAttack && player.inputSc.IsHoldingSpecialA)
|
|
|
|
|
{
|
|
|
|
|
PlayTargetedAnimation("HoldAttackStart", currentTarget);
|
|
|
|
|
_isHoldingAttack = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (functionSm["LightAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability())
|
|
|
|
|
{
|
|
|
|
|
comboSm.main.NextCombo("L");
|
|
|
|
|
functionSm["LightAttack"].Execute();
|
2026-05-23 08:27:50 -04:00
|
|
|
currentTarget = CombatManager.EnemySm.GetNearestEnemy(25f);
|
2026-06-27 12:52:03 -04:00
|
|
|
PlayTargetedAnimation("Attack" + comboSm.main.GetCurrentNodeName(), currentTarget, 5f);
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnPrimaryRelease()
|
|
|
|
|
{
|
|
|
|
|
if (_isHoldingAttack)
|
|
|
|
|
{
|
|
|
|
|
string animName = player.animationSc.fullBodyFuncAnimSm.currentRuntimeFuncAnim?.animationName;
|
|
|
|
|
if(animName == "HoldAttackLoop" || animName == "HoldAttackStart")
|
|
|
|
|
{
|
|
|
|
|
PlayTargetedAnimation("HoldAttackEnd");
|
|
|
|
|
}
|
2026-06-27 12:52:03 -04:00
|
|
|
RecallActiveSpinArea();
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_isHoldingAttack = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnSecondaryPress()
|
|
|
|
|
{
|
|
|
|
|
if (_isHoldingAttack) return;
|
|
|
|
|
|
|
|
|
|
if (functionSm["HeavyAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability())
|
|
|
|
|
{
|
|
|
|
|
comboSm.main.NextCombo("R");
|
|
|
|
|
functionSm["HeavyAttack"].Execute();
|
2026-05-23 08:27:50 -04:00
|
|
|
currentTarget = CombatManager.EnemySm.GetNearestEnemy(25f);
|
2026-06-27 12:52:03 -04:00
|
|
|
PlayTargetedAnimation("Attack" + comboSm.main.GetCurrentNodeName(), currentTarget, 5f);
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class FutureWand
|
|
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
private void RecallActiveSpinArea()
|
2026-05-10 11:47:55 -04:00
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
if (_activeSpinArea?.moveSm is BoomerangMoveSubmodule boomerangSm)
|
2026-05-10 11:47:55 -04:00
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
boomerangSm.TriggerReturn(20, 10, float.MaxValue, 0);
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-27 12:52:03 -04:00
|
|
|
private void OnPlayerGetHit(AttackAreaBase attackArea)
|
2026-05-10 11:47:55 -04:00
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
if (_isHoldingAttack)
|
2026-05-10 11:47:55 -04:00
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
string animName = player.animationSc.fullBodyFuncAnimSm.currentRuntimeFuncAnim?.animationName;
|
|
|
|
|
if (animName == "HoldAttackLoop" || animName == "HoldAttackStart")
|
2026-05-26 00:21:27 -04:00
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
PlayTargetedAnimation("HoldAttackEnd");
|
2026-05-26 00:21:27 -04:00
|
|
|
}
|
2026-06-27 12:52:03 -04:00
|
|
|
_isHoldingAttack = false;
|
2026-05-26 00:21:27 -04:00
|
|
|
}
|
2026-05-10 11:47:55 -04:00
|
|
|
|
2026-06-27 12:52:03 -04:00
|
|
|
RecallActiveSpinArea();
|
2026-05-10 11:47:55 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|