private void OnHitCallback(object sender, OnHitArgs args) { float rand = Random.Range(0.0f, 1.0f); if (rand <= probablity) { IEffect newEffect = (effect as IEffect).Clone(); EffectManager m = (args.target as Behaviour).GetComponent <EffectManager>(); if (m != null && !m.HasEffect(newEffect.Name)) { m.AddEffect(newEffect); } } }
private void OnHitCallback(object sender, OnHitArgs args) { if (OnHit != null) { OnHit(sender, args); } if (sender == mainHandWeapon && mainHandWeapon.StopPrimaryClipOnHit && mhPrimarySource != null) { Destroy(mhPrimarySource.gameObject); } else if (sender == offHandWeapon && offHandWeapon.StopPrimaryClipOnHit && ohPrimarySource != null) { Destroy(ohPrimarySource.gameObject); } }