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(); 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(attackData[vfxName]) .SetTimeSubmodule(10f) .SetHitSubmodule() .SetAdaptiveTraceMoveModule(target, speed, 5f, 20f, 20f, direction) .SetRaycastSubmodule(default, 0.25f, 0.5f) .SetForceSubmodule(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());*/ } } }