public virtual void OnCollision(GameResult gameResult, IControlable collider) { if (CanEffect(collider)) { EffectAttachmentResult attachmentResult = new EffectAttachmentResult(gameResult); collider.AttachEffects(attachmentResult, effectCollection); if (attachmentResult.WeaponIsExpired && solidHost != null) { solidHost.Kill(gameResult); } } }
public void OnCreation(GameResult gameResult, IControlable host) { EffectAttachmentResult attachmentResult = new EffectAttachmentResult(gameResult); foreach (IEffect effect in effects) { effect.OnTargetAttachment(attachmentResult, host); } foreach (IProlongedEffect prolongedEffect in prolongedEffects) { prolongedEffect.OnTargetAttachment(attachmentResult, host); } }
public void AttachEffects(EffectAttachmentResult attachmentResult, IControlable attachie, EffectCollection effectCollection) { if (effectCollection.CanEffect(attachie)) { attachmentResult.WeaponIsExpired = (effectCollection.attachmentFlags & EffectAttachmentFlags.WeaponExpires) == EffectAttachmentFlags.WeaponExpires; if ((effectCollection.attachmentFlags & EffectAttachmentFlags.ClonedAttachment) == EffectAttachmentFlags.ClonedAttachment) { foreach (IEffect effect in effectCollection.effects) { if (effect.CanEffect(attachie) && (!BlockEffect(effect))) { IEffect clone = (IEffect)effect.Clone(); clone.OnTargetAttachment(attachmentResult, attachie); effects.Add(clone); attachmentResult.EffectAttached = true; } } foreach (IProlongedEffect prolongedEffect in effectCollection.prolongedEffects) { if (prolongedEffect.CanEffect(attachie) && (!BlockEffect(prolongedEffect))) { IProlongedEffect clone = (IProlongedEffect)prolongedEffect.Clone(); clone.OnTargetAttachment(attachmentResult, attachie); prolongedEffects.Add(clone); attachmentResult.EffectAttached = true; } } } else { foreach (IEffect effect in effectCollection.effects) { if (effect.CanEffect(attachie) && (!BlockEffect(effect))) { effect.OnTargetAttachment(attachmentResult, attachie); effects.Add(effect); attachmentResult.EffectAttached = true; } } foreach (IProlongedEffect prolongedEffect in effectCollection.prolongedEffects) { if (prolongedEffect.CanEffect(attachie) && (!BlockEffect(prolongedEffect))) { prolongedEffect.OnTargetAttachment(attachmentResult, attachie); prolongedEffects.Add(prolongedEffect); attachmentResult.EffectAttached = true; } } } } }
public void AttachEffects(EffectAttachmentResult attachmentResult, EffectCollection effectCollection) { attachedEffectCollection.AttachEffects(attachmentResult, this, effectCollection); }