Files
Cielonos/Assets/Scripts/MainGame/Items/SupportEquipments/IceCone.cs

62 lines
2.2 KiB
C#
Raw Normal View History

2026-02-13 09:22:11 -05:00
using Cielonos.MainGame.Buffs.Character;
2026-01-12 03:22:16 -05:00
using Cielonos.MainGame.Characters;
2026-02-13 09:22:11 -05:00
using Cielonos.MainGame.UI;
2026-01-12 03:22:16 -05:00
using UnityEngine;
2026-05-23 08:27:50 -04:00
namespace Cielonos.MainGame.Inventory.Collections
2026-01-12 03:22:16 -05:00
{
2026-02-13 09:22:11 -05:00
public partial class IceCone : SupportEquipmentBase
2026-01-12 03:22:16 -05:00
{
2026-05-23 08:27:50 -04:00
private Transform _muzzle;
2026-02-13 09:22:11 -05:00
public override void OnObtained()
{
base.OnObtained();
2026-05-23 08:27:50 -04:00
_muzzle = player.bodyPartsSc.AuxiliaryDrone.center;
2026-02-13 09:22:11 -05:00
}
public override void OnPress()
2026-01-12 03:22:16 -05:00
{
2026-02-13 09:22:11 -05:00
if (functionSm.mainFunction.IsAvailable())
2026-01-12 03:22:16 -05:00
{
2026-05-23 08:27:50 -04:00
CharacterBase target = CombatManager.EnemySm.GetBestEnemyWithLockonFirst(50f);
GenerateProjectile("Projectile", target, 20f, _muzzle);
2026-02-13 09:22:11 -05:00
functionSm.mainFunction.Execute();
2026-05-10 11:47:55 -04:00
PlayerCanvas.SupportEquipmentsUIArea[this].UseOutlineAnimation();
2026-01-12 03:22:16 -05:00
}
2026-02-13 09:22:11 -05:00
else
2026-01-12 03:22:16 -05:00
{
2026-05-10 11:47:55 -04:00
PlayerCanvas.SupportEquipmentsUIArea[this].CanNotUseOutlineAnimation();
2026-01-12 03:22:16 -05:00
}
}
2026-02-13 09:22:11 -05:00
}
public partial class IceCone
{
private void GenerateProjectile(string vfxName, CharacterBase target, float speed, Transform muzzle = null)
2026-01-12 03:22:16 -05:00
{
2026-05-23 08:27:50 -04:00
muzzle ??= this._muzzle;
vfxData.SpawnMuzzleVFX(vfxName, player, muzzle);
Projectile projectile = vfxData.SpawnVFX(vfxName, player, muzzle).GetComponentInChildren<Projectile>();
2026-01-12 03:22:16 -05:00
2026-02-13 09:22:11 -05:00
Vector3 direction = player.transform.forward;
if (target != null)
{
2026-06-05 04:21:00 -04:00
direction = (target.CenterPoint.position - projectile.transform.position).normalized;
2026-01-12 03:22:16 -05:00
}
2026-02-13 09:22:11 -05:00
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)
2026-05-23 08:27:50 -04:00
.SetRaycastSubmodule<Projectile>(default, 0.25f, 0.5f);
projectile.SetImpulseSubmodule().WithDynamicForce(5f);
2026-02-13 09:22:11 -05:00
projectile.hitSm.AddHitEvent((hitTarget, hitPosition) =>
{
2026-05-23 08:27:50 -04:00
new Freeze.Progress(100).Apply(hitTarget, player, this);
2026-02-13 09:22:11 -05:00
});
2026-01-12 03:22:16 -05:00
}
}
}