public static bool SpawnEffectOnCollide( GameObject target, SpellPrefabManager src, GameObject effect, List <string> ignore = null, bool reverse_ignore = false) { if (ignore != null) { if (GameplayStatics.ObjHasTag(target, ignore, reverse_ignore)) { return(false); } } if (src) { if (target != src.GetOwner() && !SpellVerifySameOwnership(target, src.GetOwner())) { GameObject fx = MonoBehaviour.Instantiate(effect); fx.transform.position = GameplayStatics.GetTriggerContactPoint(target, src.gameObject); return(true); } } return(false); }
public override void SpellCollisionEnter(Collision2D target, GameObject src) { Debug.Log("CollisionEnter"); GameObject target_obj = target.gameObject; SpellPrefabManager s_manager = src.GetComponent <SpellPrefabManager>(); SpellUtilities.CastSpellOnCollide(target.gameObject, s_manager, m_SpellToCast, spawn_pos: GameplayStatics.GetTriggerContactPoint(target.gameObject, src), SpellUtilities.invalid); if (target_obj != s_manager.GetOwner() && !GameplayStatics.ObjHasTag(target_obj, SpellUtilities.invalid)) { GameObject.Destroy(src); } }
public override void OnCollisionHitEvent(Collision2D collision, GameObject src, OnCollisionData data) { var m_SpellToCast = data.m_CastSpellOnHitData.m_Spell; if (!m_SpellToCast) { return; } var invalids = data.m_CastSpellOnHitData.m_invalid; SpellPrefabManager s_manager = src.GetComponent <SpellPrefabManager>(); if (!data.m_CastSpellOnHitData.m_EnemyOnly) { SpellUtilities.CastSpellOnCollide(collision.gameObject, s_manager, m_SpellToCast, GameplayStatics.GetTriggerContactPoint(collision.gameObject, src), invalids); } else if (collision.gameObject.CompareTag("Enemy")) { SpellUtilities.CastSpellOnCollide(collision.gameObject, s_manager, m_SpellToCast, GameplayStatics.GetTriggerContactPoint(collision.gameObject, src)); } }