// This handles the logic for the projectile "connecting" with it's target public void OnTriggerEnter2D(Collider2D collision) { BattleNPC colNPC = collision.gameObject.GetComponentInChildren <BattleNPC>(); if (colNPC != null) { if (!m_ParentSkillByte.Blockable) { if ((m_mainTarget != null) && (m_mainTarget == colNPC)) { if (m_ProjectileDamageMultiplier != 0) { m_ParentSkillByte.OnSkillByteHit(colNPC, m_ProjectileDamageMultiplier); } m_ParentSkillByte.DeRegisterProjectile(this); } } else { SkillByte.TargetType targetType = m_ParentSkillByte.Target; bool isValidTarget = (targetType == SkillByte.TargetType.AnyTarget) || ((targetType == SkillByte.TargetType.AlliedTargets) && !BattleGlobals.IsHostileToTag(this.tag, colNPC.tag)) || ((targetType == SkillByte.TargetType.EnemyTargets) && BattleGlobals.IsHostileToTag(this.tag, colNPC.tag)); if (colNPC.Alive && isValidTarget) { if (m_ProjectileDamageMultiplier != 0) { m_ParentSkillByte.OnSkillByteHit(colNPC, m_ProjectileDamageMultiplier); } m_ParentSkillByte.DeRegisterProjectile(this); } } } }
public virtual void OnTriggerEnter2D(Collider2D collision) { BattleNPC colNPC = collision.gameObject.GetComponentInChildren <BattleNPC>(); if (colNPC != null) { if (!Blockable) { int targetIndex = CheckValidTarget(colNPC); if ((targetIndex != -1)) { OnSkillByteHit(NPCTargets[targetIndex].Focus, NPCTargets[targetIndex].Multiplier); } } else { if (colNPC.Alive && BattleGlobals.IsHostileToTag(ParentSkill.SkillOwner.tag, colNPC.tag)) { OnSkillByteHit(colNPC); } } } }