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(); 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(attackData[vfxName]) .SetTimeSubmodule(10f) .SetHitSubmodule() .SetAdaptiveTraceMoveModule(target, speed, 5f, 20f, 20f, direction) .SetRaycastSubmodule(default, 0.25f, 0.5f) .SetForceSubmodule(5f); //audioContainer.PlaySoundFX(vfxName + "Release", projectile.gameObject, true); /*projectile.hitSm.AddHitSound(vfxName.Replace("Projectile", "") + "Hit") .AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play());*/ } } } }