// Функции-запускатели событий этого класса, что подписываются на GameManager.ExchangeEvent1-2 private void OnExchange1() { if ((preCoeffs[0].exchangeResult == ExchangeResult.GetHit) || (preCoeffs[0].exchangeResult == ExchangeResult.BlockVs2Handed)) { GetHitEvent?.Invoke(1); if (_HP.TakeDamage(/*damage1*/ gotDamage)) { InvokeDeathEvent(); } } if (decision == Decision.Attack) { if (preCoeffs[0].exchangeResult == ExchangeResult.Parry) { ParryEvent?.Invoke(1); } if (preCoeffs[0].exchangeResult == ExchangeResult.Block) { BlockEvent?.Invoke(1); } if (preCoeffs[0].exchangeResult == ExchangeResult.BlockVs2Handed) { BlockVs2HandedEvent?.Invoke(); } } if (preCoeffs[0].exchangeResult == ExchangeResult.Evade) { EvadeEvent?.Invoke(1); } }
protected virtual void OnExchange2() { if (decision == Decision.Attack) { AttackEvent?.Invoke(); } if ((preCoeffs[1].exchangeResult == ExchangeResult.GetHit) && !m_dead) // если не помер после первого удара { GetHitEvent?.Invoke(2); // то принимаем второй if (_HP.TakeDamage(/*damage2*/ gotDamage)) { InvokeDeathEvent(); } } if (((decision == Decision.ChangeSwordShield) || (decision == Decision.ChangeSwordSword) || (decision == Decision.ChangeTwoHandedSword)) && !m_dead) { ChangeEvent?.Invoke(); } else { if (preCoeffs[1].exchangeResult == ExchangeResult.Parry) { ParryEvent?.Invoke(2); } if (preCoeffs[1].exchangeResult == ExchangeResult.Block) { BlockEvent?.Invoke(2); } } if (preCoeffs[1].exchangeResult == ExchangeResult.Evade) { EvadeEvent?.Invoke(2); } }