示例#1
0
            public override void OnAfterDelete()
            {
                base.OnAfterDelete();

                if (_Aura != null)
                {
                    _Aura.Clear();
                    _Aura = null;
                }
            }
示例#2
0
            public override void OnThink()
            {
                base.OnThink();

                if (Deleted || !Alive || !Aspect.InCombat())
                {
                    return;
                }

                if (!this.InCombat() && Utility.RandomDouble() < 0.01)
                {
                    var t = Aspect.AcquireRandomTarget(Aspect.RangePerception);

                    if (t != null)
                    {
                        if (this.PlayAttackAnimation())
                        {
                            this.PlayAttackSound();
                        }

                        MoveToWorld(t.Location, t.Map);
                    }
                }

                if (_Aura == null)
                {
                    _Aura = new AirExplodeEffect(Location, Map, 2)
                    {
                        AverageZ      = false,
                        Interval      = TimeSpan.FromMilliseconds(500.0),
                        EffectMutator = e =>
                        {
                            if (e.ProcessIndex == 0 && Utility.RandomDouble() < 0.33)
                            {
                                e.SoundID = Utility.RandomMinMax(20, 22);
                            }

                            e.Hue = Hue;
                        },
                        EffectHandler = HandleAura,
                        Callback      = () =>
                        {
                            if (this.PlayAttackAnimation())
                            {
                                this.PlayAttackSound();
                            }
                        }
                    };
                }

                if (_Aura.Sending || Core.TickCount < _NextAura)
                {
                    return;
                }

                _NextAura = Core.TickCount + 5000;

                _Aura.Start = Location;
                _Aura.Map   = Map;
                _Aura.Send();
            }