using Cielonos.MainGame.Characters; using UnityEngine; namespace Cielonos.MainGame.Inventory { public partial class FutureWand : MainWeaponBase { public CharacterBase currentTarget; public override void OnEquipped() { base.OnEquipped(); RegisterFunctionsToAnimSc(SwingForward, SwingDown, LightAttack0, LightAttack1_0, LightAttack1_1, LightAttack2, LightAttack3, HeavyAttack); } public override void OnPrimaryPress() { if (functionSm["LightAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability()) { comboSm.NextCombo("L"); functionSm["LightAttack"].Execute(); currentTarget = BattleManager.EnemySm.GetNearestEnemy(25f); if (currentTarget != null) { PlayTargetedAnimation("LightAttack" + comboSm.GetCurrentNodeName(), currentTarget, 5f); } } } public override void OnSecondaryPress() { if (functionSm["HeavyAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability()) { comboSm.ResetCombo(); functionSm["HeavyAttack"].Execute(); currentTarget = BattleManager.EnemySm.GetNearestEnemy(10f); if (currentTarget != null) { PlayTargetedAnimation("HeavyAttack", currentTarget, 3f); } } } } public partial class FutureWand { private void LightAttack0() => GenerateProjectile("NormalProjectile", currentTarget, 10f); private void LightAttack1_0() => GenerateProjectile("NormalProjectile", currentTarget, 10f); private void LightAttack1_1() => GenerateProjectile("NormalProjectile", currentTarget, 10f, player.bodyPartsSc.leftHand); private void LightAttack2() => GenerateProjectile("NormalProjectile", currentTarget, 10f); private void LightAttack3() => GenerateProjectile("HeavyProjectile", currentTarget, 10f); private void HeavyAttack() => GenerateGroundArea("GroundArea"); } public partial class FutureWand { private void SwingForward() { Swing("Swing", "Swing", Vector3.forward * 0.2f); Debug.Log("SwingForward executed"); } private void SwingDown() => Swing("Swing", "Swing", Vector3.down * 0.3f); private void GenerateProjectile(string vfxName, CharacterBase target, float speed, Transform muzzle = null) { muzzle ??= this.muzzle; vfxData.SpawnMuzzleVFX(vfxName, muzzle); Projectile projectile = vfxData.SpawnVFX(vfxName).GetComponentInChildren(); AttackUnit attackUnit = attackData["LightAttack"].Clone(); attackUnit.hitVFX = vfxData.Get(vfxName).hitVFX; 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(attackUnit) .SetTimeSubmodule(10f) .SetHitSubmodule() .SetTraceMoveModule(currentTarget, speed, 5f, 20f, 20f, direction) .SetRaycastSubmodule() .SetForceSubmodule(5f); audioContainer.PlaySoundFX(vfxName + "Release", projectile.gameObject, true); projectile.hitSm.AddHitSound(vfxName.Replace("Projectile", "") + "Hit") .AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play()); } private void GenerateGroundArea(string vfxName) { vfxData.SpawnMuzzleVFX(vfxName, muzzle); NormalArea area = vfxData.SpawnVFX(vfxName).GetComponentInChildren(); AttackUnit attackUnit = attackData["LightAttack"].Clone(); attackUnit.hitVFX = vfxData.Get(vfxName).hitVFX; area.Initialize(player, this, Fraction.Enemy) .SetAttackSubmodule(attackUnit) .SetTimeSubmodule(1f, 0.8f, 0.2f) .SetHitSubmodule(0.1f, 5) .SetForceSubmodule(5f, false); audioContainer.PlaySoundFX("GroundArea", area.gameObject, true); area.hitSm.AddHitSound("NormalHit") .AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play()); } } }