65 lines
2.6 KiB
C#
65 lines
2.6 KiB
C#
using Cielonos.MainGame.Characters;
|
|
using Cielonos.UI;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame
|
|
{
|
|
namespace 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["Shoot"].IsAvailable())
|
|
{
|
|
//audioContainer.PlaySoundFX("Shoot", muzzle.gameObject);
|
|
CharacterBase enemy = BattleManager.EnemySm.GetNearestEnemy(50f);
|
|
GenerateProjectile("Projectile", enemy, 20f, muzzle);
|
|
functionSm["Shoot"].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.flexibleCenterPoint.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);
|
|
|
|
//audioContainer.PlaySoundFX(vfxName + "Release", projectile.gameObject, true);
|
|
|
|
/*projectile.hitSm.AddHitSound(vfxName.Replace("Projectile", "") + "Hit")
|
|
.AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play());*/
|
|
}
|
|
}
|
|
}
|
|
} |