Files
Cielonos/Assets/Scripts/MainGame/Characters/Player/Items/SupportEquipments/IceCone.cs
SoulliesOfficial f26f9fd374 爆更
2026-03-20 12:07:44 -04:00

68 lines
2.5 KiB
C#

using Cielonos.MainGame.Buffs;
using Cielonos.MainGame.Buffs.Character;
using Cielonos.MainGame.Characters;
using Cielonos.MainGame.UI;
using UnityEngine;
namespace Cielonos.MainGame.Characters.Inventory.Collections
{
public partial class IceCone : SupportEquipmentBase
{
private Transform muzzle;
public override void OnObtained()
{
base.OnObtained();
muzzle = player.bodyPartsSc.AuxiliaryDrone.center;
}
public override void OnPress()
{
if (functionSm.mainFunction.IsAvailable())
{
CharacterBase enemy = BattleManager.EnemySm.GetNearestEnemy(50f);
GenerateProjectile("Projectile", enemy, 20f, muzzle);
functionSm.mainFunction.Execute();
PlayerCanvas.Instance.supportEquipmentsUIArea[this].UseOutlineAnimation();
}
else
{
PlayerCanvas.Instance.supportEquipmentsUIArea[this].CanNotUseOutlineAnimation();
}
}
}
public partial class IceCone
{
private void GenerateProjectile(string vfxName, CharacterBase target, float speed, Transform muzzle = null)
{
muzzle ??= this.muzzle;
vfxData.SpawnMuzzleVFX(vfxName, muzzle);
Projectile projectile = vfxData.SpawnVFX(vfxName, muzzle).GetComponentInChildren<Projectile>();
Vector3 direction = player.transform.forward;
if (target != null)
{
direction = (target.centerPoint.position - projectile.transform.position).normalized;
}
projectile.Initialize(player, this, false, 1, Fraction.Enemy)
.SetAttackSubmodule<Projectile>(attackData[vfxName])
.SetTimeSubmodule<Projectile>(10f)
.SetHitSubmodule<Projectile>()
.SetAdaptiveTraceMoveModule<Projectile>(target, speed, 5f, 20f, 20f, direction)
.SetRaycastSubmodule<Projectile>(default, 0.25f, 0.5f)
.SetForceSubmodule<Projectile>(5f);
projectile.hitSm.AddHitEvent((hitTarget, hitPosition) =>
{
new Freeze.Progress(1000).Apply(hitTarget, player, this);
});
//audioContainer.PlaySoundFX(vfxName + "Release", projectile.gameObject, true);
/*projectile.hitSm.AddHitSound(vfxName.Replace("Projectile", "") + "Hit")
.AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play());*/
}
}
}