Пример #1
0
        protected static SimDescription GetEventSim(Event e)
        {
            SimDescriptionEvent simDescEvent = e as SimDescriptionEvent;

            if (simDescEvent != null)
            {
                return(simDescEvent.SimDescription);
            }
            else
            {
                MiniSimDescriptionEvent miniSimEvent = e as MiniSimDescriptionEvent;
                if (miniSimEvent != null)
                {
                    return(miniSimEvent.MiniSimDescription as SimDescription);
                }
                else
                {
                    Sim sim = e.Actor as Sim;
                    if (sim == null)
                    {
                        sim = e.TargetObject as Sim;
                        if (sim == null)
                        {
                            return(null);
                        }
                    }

                    return(sim.SimDescription);
                }
            }
        }
Пример #2
0
        protected ListenerAction OnKill(Event e)
        {
            try
            {
                SimDescription sim = null;

                SimDescriptionEvent event2 = e as SimDescriptionEvent;
                if (event2 != null)
                {
                    sim = event2.SimDescription;
                }
                else
                {
                    MiniSimDescriptionEvent event3 = e as MiniSimDescriptionEvent;
                    if (event3 != null)
                    {
                        sim = event3.MiniSimDescription as SimDescription;
                    }
                }

                if (!TargetDead(sim))
                {
                    return(ListenerAction.Keep);
                }
                else
                {
                    return(ListenerAction.Remove);
                }
            }
            catch (Exception exception)
            {
                Common.Exception(e.Actor, e.TargetObject, exception);
                return(ListenerAction.Keep);
            }
        }