2025-11-25 08:19:33 -05:00
|
|
|
using System;
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
2026-01-03 18:19:39 -05:00
|
|
|
using Cielonos.MainGame.Inventory;
|
2025-11-25 08:19:33 -05:00
|
|
|
using DamageNumbersPro;
|
|
|
|
|
using Lean.Pool;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Object = UnityEngine.Object;
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame
|
|
|
|
|
{
|
|
|
|
|
public class AttackSubmodule : AttackAreaSubmoduleBase
|
|
|
|
|
{
|
|
|
|
|
public bool isOverridingHitEffect;
|
|
|
|
|
public GameObject hitVFXPrefab;
|
2026-02-13 09:22:11 -05:00
|
|
|
|
2026-01-03 18:19:39 -05:00
|
|
|
public AttackUnit attackUnit;
|
|
|
|
|
public AttackValue attackValue;
|
2025-11-25 08:19:33 -05:00
|
|
|
|
|
|
|
|
public Action<GameObject, CharacterBase> modifyHitEffectAction;
|
|
|
|
|
|
2026-01-03 18:19:39 -05:00
|
|
|
public AttackSubmodule(AttackAreaBase attackArea, AttackUnit attackUnit, GameObject hitVFXPrefab) : base(attackArea)
|
2025-11-25 08:19:33 -05:00
|
|
|
{
|
2026-01-03 18:19:39 -05:00
|
|
|
this.attackUnit = attackUnit;
|
|
|
|
|
this.attackValue = attackUnit.GetAttackValue(owner.creator);
|
2025-11-25 08:19:33 -05:00
|
|
|
this.isOverridingHitEffect = false;
|
|
|
|
|
this.hitVFXPrefab = hitVFXPrefab;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-17 04:19:38 -05:00
|
|
|
public GameObject SpawnHitVFX(CharacterBase creator, Vector3 position, Vector3 direction = default)
|
2025-11-25 08:19:33 -05:00
|
|
|
{
|
|
|
|
|
if (isOverridingHitEffect) return null;
|
|
|
|
|
|
|
|
|
|
if (hitVFXPrefab != null)
|
|
|
|
|
{
|
|
|
|
|
direction = direction == default ? direction : Vector3.up;
|
2025-12-17 04:19:38 -05:00
|
|
|
GameObject hitEffect = VFXObject.Spawn(hitVFXPrefab, creator, position, Quaternion.LookRotation(direction));
|
2025-11-25 08:19:33 -05:00
|
|
|
return hitEffect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|