MUDServer.CombatEntity.EndCombat C# (CSharp) Method

EndCombat() public method

public EndCombat ( ) : void
return void
        public void EndCombat()
        {
            if (!_InCombat)
                throw new InvalidOperationException("Attempted to end combat while not in combat.");

            _CombatTarget = null;
            _InCombat = false;
            _CombatTask.Dispose();
        }

Usage Example

Example #1
0
        private IEnumerator <object> OnEventLeave(EventType type, object evt)
        {
            if (!InCombat)
            {
                return(null);
            }

            IEntity sender = Event.GetProp <IEntity>("Sender", evt);

            if (sender == _CombatTarget)
            {
                _CombatTarget.EndCombat();
                EndCombat();
            }

            return(null);
        }