protected virtual void OnCollisionEnter(Collision collision) { if (!CanTrap(collision.gameObject)) { return; } _triggered = true; ITrapable trapableObj = collision.gameObject.GetComponent <ITrapable>(); if (trapableObj != null) { trapableObj.SetTrapped(this); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate } else if (targeted is IEntity) { from.Direction = from.GetDirectionTo(((IEntity)targeted).Location); if (targeted is ITrapable) { ITrapable targ = (ITrapable)targeted; if (!targ.Trap_IsTrapped) { from.SendLocalizedMessage(502373); // That doesn't appear to be trapped return; } from.PlaySound(0x241); if (from.CheckTargetSkill(SkillName.Pieges, targ, targ.Trap_DisarmDifficulty, targ.Trap_DisarmDifficulty + 20)) { targ.Trap_Disarm(); from.SendLocalizedMessage(502377); // You successfully render the trap harmless } else { from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off } } } else { from.SendLocalizedMessage(502373); // That does'nt appear to be trapped } }
public TrapResetTimer(TimeSpan duration, ITrapable item) : base(duration) { m_Item = item; Start(); }