void OnTriggerEnter(Collider other) { if (other.gameObject.layer == CommonValue.Layers.Attack) { AttackBox attackBox = other.gameObject.GetComponent <AttackBox>(); if (attackBox && ReferenceEquals(attackBox.Attack.Target, damageableObject)) { attackBox.Ineffective(); damageableObject.ReceiveDamage(UnityRandom.value * 3.0f); } } }
private bool IsAttackAgainstMe(GameObject gameObject, out AttackAction attack) { AttackBox attackBox = gameObject.GetComponent <AttackBox>(); if (attackBox && attackBox.Attack.SourceEntity.TargetedEnemy == entityCombatController) { attack = attackBox.Attack; return(true); } attack = null; return(false); }
public AttackAction(OffensiveActionData data, AttackBox attackBox) : base() { ActionData = data; AttackBox = attackBox; }