Files
Cielonos/Assets/Scripts/MainGame/Characters/Player/Items/MainWeapons/FutureWand.cs

172 lines
7.0 KiB
C#
Raw Normal View History

2025-12-24 16:58:51 -05:00
using System.Collections.Generic;
2025-11-25 08:19:33 -05:00
using Cielonos.MainGame.Characters;
2026-02-13 09:22:11 -05:00
using Cielonos.MainGame.UI;
using SLSUtilities.General;
2025-11-25 08:19:33 -05:00
using UnityEngine;
2026-03-20 12:07:44 -04:00
namespace Cielonos.MainGame.Characters.Inventory.Collections
2025-11-25 08:19:33 -05:00
{
public partial class FutureWand : MainWeaponBase
{
public CharacterBase currentTarget;
public override void OnEquipped()
{
base.OnEquipped();
2025-12-24 16:58:51 -05:00
RegisterFunctionsToAnimSc(SwingForward, SwingDown, LightAttack0, LightAttack1_0, LightAttack1_1,
LightAttack2, LightAttack3, HeavyAttack, ReleaseAura);
PlayTargetedAnimation("Equip");
2026-01-12 03:22:16 -05:00
viewObjects["Wand"].SetFadeAnim(0.5f);
2026-01-03 18:19:39 -05:00
PlayerCanvas.Instance.mainWeaponUIArea.displayer.SetFrameOutline(1);
2025-11-25 08:19:33 -05:00
}
public override void OnPrimaryPress()
{
if (functionSm["LightAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability())
{
2026-01-17 11:35:49 -05:00
comboSm.main.NextCombo("L");
2025-12-08 05:27:53 -05:00
functionSm["LightAttack"].Execute();
2025-11-25 08:19:33 -05:00
currentTarget = BattleManager.EnemySm.GetNearestEnemy(25f);
if (currentTarget != null)
{
2026-01-17 11:35:49 -05:00
PlayTargetedAnimation("LightAttack" + comboSm.main.GetCurrentNodeName(), currentTarget, 5f);
2025-11-25 08:19:33 -05:00
}
2025-12-23 19:47:06 -05:00
else
{
2026-01-17 11:35:49 -05:00
PlayTargetedAnimation("LightAttack" + comboSm.main.GetCurrentNodeName());
2025-12-23 19:47:06 -05:00
}
2025-11-25 08:19:33 -05:00
}
}
public override void OnSecondaryPress()
{
if (functionSm["HeavyAttack"].IsAvailable() && fullBodyFuncAnimSm.CheckPlayability())
{
2026-01-17 11:35:49 -05:00
comboSm.main.Reset();
2025-12-08 05:27:53 -05:00
functionSm["HeavyAttack"].Execute();
2025-11-25 08:19:33 -05:00
currentTarget = BattleManager.EnemySm.GetNearestEnemy(10f);
if (currentTarget != null)
{
PlayTargetedAnimation("HeavyAttack", currentTarget, 3f);
}
2025-12-23 19:47:06 -05:00
else
{
PlayTargetedAnimation("HeavyAttack", null, 3f);
}
2025-11-25 08:19:33 -05:00
}
}
}
public partial class FutureWand
{
2026-01-03 18:19:39 -05:00
private void LightAttack0() => GenerateProjectile("NormalProjectile", currentTarget, Vector3.down, 10f);
private void LightAttack1_0() => GenerateProjectile("NormalProjectile", currentTarget, Vector3.up, 10f);
private void LightAttack1_1() => GenerateProjectile("NormalProjectile", currentTarget, Vector3.zero, 10f, player.bodyPartsSc.leftHand);
private void LightAttack2() => GenerateProjectile("NormalProjectile", currentTarget, Vector3.down * 2, 10f);
private void LightAttack3() => GenerateProjectile("HeavyProjectile", currentTarget, Vector3.up * 3, 10f);
2025-11-25 08:19:33 -05:00
private void HeavyAttack() => GenerateGroundArea("GroundArea");
2025-12-24 16:58:51 -05:00
private void ReleaseAura() => GenerateSquareExpandingAura("SquareExpandingAura");
2025-11-25 08:19:33 -05:00
}
2025-12-23 19:47:06 -05:00
2026-01-03 18:19:39 -05:00
public partial class FutureWand
2025-12-23 19:47:06 -05:00
{
private Transform muzzle => viewObjects["Wand"].functionalParts["Muzzle"].transform;
}
2025-11-25 08:19:33 -05:00
public partial class FutureWand
{
private void SwingForward()
{
2026-01-03 18:19:39 -05:00
//Swing("Swing", "Swing", Vector3.forward * 0.2f);
2025-11-25 08:19:33 -05:00
}
2026-01-03 18:19:39 -05:00
private void SwingDown()
{
//Swing("Swing", "Swing", Vector3.down * 0.3f);
}
2025-11-25 08:19:33 -05:00
2026-01-03 18:19:39 -05:00
private void GenerateProjectile(string vfxName, CharacterBase target, Vector3 swingRotation, float speed, Transform muzzle = null)
2025-11-25 08:19:33 -05:00
{
muzzle ??= this.muzzle;
vfxData.SpawnMuzzleVFX(vfxName, muzzle);
Projectile projectile = vfxData.SpawnVFX(vfxName).GetComponentInChildren<Projectile>();
Vector3 direction = player.transform.forward;
if (target != null)
{
2026-02-13 09:22:11 -05:00
direction = (target.centerPoint.position - projectile.transform.position).normalized;
2025-11-25 08:19:33 -05:00
}
projectile.Initialize(player, this, false, 1, Fraction.Enemy)
2026-01-03 18:19:39 -05:00
.SetAttackSubmodule<Projectile>(attackData[vfxName])
2025-11-25 08:19:33 -05:00
.SetTimeSubmodule<Projectile>(10f)
.SetHitSubmodule<Projectile>()
2026-01-12 03:22:16 -05:00
.SetAdaptiveTraceMoveModule<Projectile>(target, speed, 5f, 20f, 20f, direction)
2025-12-24 16:58:51 -05:00
.SetRaycastSubmodule<Projectile>(default, 0.25f, 0.5f)
2025-11-25 08:19:33 -05:00
.SetForceSubmodule<Projectile>(5f);
2026-02-13 09:22:11 -05:00
//Swing("Swing", "Swing", swingRotation);
2025-11-25 08:19:33 -05:00
audioContainer.PlaySoundFX(vfxName + "Release", projectile.gameObject, true);
2026-03-20 12:07:44 -04:00
projectile.hitSm.AddHitSound(AK.EVENTS.FUTUREWAND_NORMALHIT)
2025-11-25 08:19:33 -05:00
.AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play());
}
private void GenerateGroundArea(string vfxName)
{
vfxData.SpawnMuzzleVFX(vfxName, muzzle);
NormalArea area = vfxData.SpawnVFX(vfxName).GetComponentInChildren<NormalArea>();
area.Initialize<NormalArea>(player, this, Fraction.Enemy)
2026-01-03 18:19:39 -05:00
.SetAttackSubmodule<NormalArea>(attackData["GroundArea"])
2025-12-24 16:58:51 -05:00
.SetTimeSubmodule<NormalArea>(1f, 0.2f, 0.8f)
2025-11-25 08:19:33 -05:00
.SetHitSubmodule<NormalArea>(0.1f, 5)
.SetForceSubmodule<NormalArea>(5f, false);
2026-02-13 09:22:11 -05:00
//Swing("Swing", "Swing", Vector3.right);
2025-11-25 08:19:33 -05:00
audioContainer.PlaySoundFX("GroundArea", area.gameObject, true);
2026-03-20 12:07:44 -04:00
area.hitSm.AddHitSound(AK.EVENTS.FUTUREWAND_NORMALHIT)
2025-11-25 08:19:33 -05:00
.AddHitEvent((enemy, hitPosition) => feedbackSc["Hit"].Play());
}
2025-12-24 16:58:51 -05:00
private void GenerateSquareExpandingAura(string vfxName)
{
vfxData.SpawnMuzzleVFX(vfxName, muzzle);
NormalArea area = vfxData.SpawnVFX(vfxName).GetComponentInChildren<NormalArea>();
area.Initialize<NormalArea>(player, this, Fraction.Enemy)
2026-01-03 18:19:39 -05:00
.SetAttackSubmodule<NormalArea>(attackData["SquareAura"])
2025-12-24 16:58:51 -05:00
.SetTimeSubmodule<NormalArea>(4f, 0.2f, 2.8f)
.SetHitSubmodule<NormalArea>()
.SetTransformSubmodule<NormalArea>();
2026-01-03 18:19:39 -05:00
audioContainer.PlaySoundFX("SquareAura", area.gameObject, true);
2026-02-13 09:22:11 -05:00
//Swing("Swing", "Swing", Vector3.left);
2026-01-03 18:19:39 -05:00
2025-12-24 16:58:51 -05:00
area.transformSm.ApplyScaleMove(Vector3.one, Vector3.one * 50, 1f, EaseType.OutQuart);
area.updateAction = () =>
{
if (area.timeSm.enablingTime > 3f)
{
return;
}
List<Projectile> toBeRemoved = new List<Projectile>();
foreach (Projectile projectile in BattleManager.AttackAreaSm.enemyAttackAreas.activeProjectiles)
{
if (area.areaCollider.IsPointInside(projectile.topParent.transform.position))
{
toBeRemoved.Add(projectile);
}
}
foreach (Projectile projectile in toBeRemoved)
{
projectile.Explode();
}
};
}
2025-11-25 08:19:33 -05:00
}
}