Example #1
0
File: Door.cs Project: jpx/blazera
        void SetAntiLoop()
        {
            if (Binding.Teleporter == null)
            {
                // binded door is not itself binded
                return;
            }

            // if binded warp point contains player future position
            // we avoid to re-teleport the player
            Teleporter.TeleportationEvent += new DefaultAction((args) =>
            {
                Binding.Teleporter.TeleportationEvent.Activate(false);

                ObjectEvent lockEvent = new TemporaryEvent(1, ObjectEventType.Out);
                Binding.Teleporter.TeleportationBB.AddEvent(lockEvent);
                lockEvent += new DefaultAction((args2) =>
                {
                    Binding.Teleporter.TeleportationEvent.Activate(true);
                });

                AntiLoopCheckEvent = new TemporaryEvent(1, ObjectEventType.In);
                Binding.Teleporter.TeleportationBB.AddEvent(AntiLoopCheckEvent);
                AntiLoopCheckEvent += new DefaultAction((args2) =>
                {
                    BindingContainsBindedWarpPoint = true;
                });

                Binding.OnUpdate += new UpdateEventHandler(Binding_OnUpdate);
            });
        }