44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
using Cielonos.MainGame.Characters;
|
|
using Cielonos.MainGame.Characters.Inventory;
|
|
using DamageNumbersPro;
|
|
using Lean.Pool;
|
|
using UnityEngine;
|
|
using Object = UnityEngine.Object;
|
|
|
|
namespace Cielonos.MainGame
|
|
{
|
|
public class AttackSubmodule : AttackAreaSubmoduleBase
|
|
{
|
|
public bool isOverridingHitEffect;
|
|
public GameObject hitVFXPrefab;
|
|
|
|
public AttackUnit attackUnit;
|
|
public AttackValue attackValue;
|
|
|
|
public Action<GameObject, CharacterBase> modifyHitEffectAction;
|
|
public Action<CharacterBase, Vector3> breakthroughAction;
|
|
|
|
public AttackSubmodule(AttackAreaBase attackArea, AttackUnit attackUnit, GameObject hitVFXPrefab) : base(attackArea)
|
|
{
|
|
this.attackUnit = attackUnit;
|
|
this.attackValue = attackUnit.GetAttackValue(owner.creator);
|
|
this.isOverridingHitEffect = false;
|
|
this.hitVFXPrefab = hitVFXPrefab;
|
|
}
|
|
|
|
public GameObject SpawnHitVFX(CharacterBase creator, Vector3 position, Vector3 direction = default)
|
|
{
|
|
if (isOverridingHitEffect) return null;
|
|
|
|
if (hitVFXPrefab != null)
|
|
{
|
|
direction = direction != default ? direction : Vector3.up;
|
|
GameObject hitEffect = VFXObject.Spawn(hitVFXPrefab, creator, position, Quaternion.LookRotation(direction));
|
|
return hitEffect;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |