virtual protected void OnTriggerEnter(Collider other) { Damageable oppDamageable = other.GetComponent <Damageable>(); if (oppDamageable) { bool touched = oppDamageable.TakeDamage(this, m_currData.damage, m_attackID); if (!touched) { return; } if (other.gameObject.layer == LayerMask.NameToLayer("EnemyHitBox")) { OnHitEvent.Invoke(m_firstHit, m_currData.damage); } m_firstHit = false; ManageFXObject(other.gameObject); if (!oppDamageable.IsAlive()) { return; } BasicMovement mvmt = other.gameObject.GetComponentInParent <BasicMovement>(); if (mvmt) { ManageCrowdControlEffect(mvmt); } } }
protected void ManageCrowdControlEffect(BasicMovement movingEntity) { if (movingEntity.HasSuperArmor) { return; } switch (m_currData.CC) { case CrowdControl.Stagger: { movingEntity.Stagger(); break; } case CrowdControl.KnockBack: { float playerRotY = transform.rotation.eulerAngles.y; if (playerRotY == 0f) { movingEntity.Knock(m_currData.CCForce, Vector3.right); } else { movingEntity.Knock(m_currData.CCForce, Vector3.left); } break; } case CrowdControl.KnockDown: { movingEntity.Knock(m_currData.CCForce, Vector3.down); break; } case CrowdControl.KnockUp: { movingEntity.Knock(m_currData.CCForce, Vector3.up); break; } case CrowdControl.SlamDown: { movingEntity.Knock(m_currData.CCForce, Vector3.down); break; } case CrowdControl.Expell: { Vector3 dir = movingEntity.transform.position - transform.position; movingEntity.Knock(m_currData.CCForce, dir); break; } default: break; } }
// Use this for initialization protected virtual void Awake() { m_movement = GetComponent <BasicMovement>(); m_positionDetector = GetComponent <PositionDetector>(); m_animator = GetComponentInChildren <Animator>(); m_movement.OnAttackInterrupt.AddListener(OnAttackInterrupt); }