示例#1
0
        public EBoundingBox(EBoundingBox copy, WorldObject holder)
            : base(copy, holder)
        {
            Type = copy.Type;

            Events = new List<ObjectEvent>(copy.Events);
            EventsToRemove = new Queue<ObjectEvent>();
        }
示例#2
0
文件: Teleporter.cs 项目: jpx/blazera
        void SetArea(IntRect rect)
        {
            Area = rect;

            TeleportationBB = new EBoundingBox(this, EBoundingBoxType.Event, Area.Left, Area.Top, Area.Right, Area.Bottom);
            TeleportationEvent = new ObjectEvent(ObjectEventType.In);
            TeleportationEvent.AddAction(new WarpAction(MapName, WarpPointName));
            TeleportationBB.AddEvent(TeleportationEvent);
            AddEventBoundingBox(TeleportationBB, EventBoundingBoxType.Internal);
        }
示例#3
0
文件: Door.cs 项目: jpx/blazera
        public void BindTo(Door door)
        {
            if (Binding != null || door == null)
                return;

            Binding = door;

            // teleporter associate to the door
            Teleporter = Create.Teleporter("Invisible");
            Teleporter.SetSetting(Binding.Map.Type, Binding.WarpPoint.Name, Area);
            Teleporter.SetMap(Map, Position.X, Position.Y, Z);

            OnMove += new MoveEventHandler(Door_OnMove);

            // block BB when the door is closed
            BlockBB = new BBoundingBox(this, 0, 42, 32, 46);
            AddBoundingBox(BlockBB);

            // sides block BB
            AddBoundingBox(new BBoundingBox(this, 0, 42, 2, 46));
            AddBoundingBox(new BBoundingBox(this, 30, 42, 32, 46));

            // switch open/close state event BB
            EBoundingBox doorBB = new EBoundingBox(this, EBoundingBoxType.Event, 0 - 5, 44, 32 + 5, 56);
            AddEventBoundingBox(doorBB, EventBoundingBoxType.Internal);
            ObjectEvent doorEvt = new ObjectEvent(ObjectEventType.Normal, true, InputType.Action);
            doorBB.AddEvent(doorEvt);

            doorEvt.AddAction(new DefaultAction((args) =>
            {
                if (IsLocked() && args.Player.DirectionHandler.IsFacing(this))
                    LaunchLockedMessage();

                if (IsLocked() || IsClosing() || IsOpening())
                    return;

                if (args.Player.DirectionHandler.IsFacing(this))
                {
                    if (IsOpen())
                        Close();
                    else
                        Open();
                }
            }));

            TrySetState("Open");

            // anti loop event
            if (ANTI_LOOP_CHECK_IS_ACTIVE)
                SetAntiLoop();
        }
示例#4
0
 public void CallEvent(ObjectEventType type, EBoundingBox source, EBoundingBox trigger)
 {
     CallEvent(type, new ObjectEventArgs(source, trigger));
 }
示例#5
0
        public ObjectEventArgs(EBoundingBox source, EBoundingBox trigger)
        {
            Source = source;
            Trigger = trigger;

            if (Trigger.Holder is Player)
                Player = (Player)Trigger.Holder;
            else if (Source.Holder is Player)
                Player = (Player)Source.Holder;

            Map = source.Holder.Map;
        }
示例#6
0
 public virtual void SetParent(EBoundingBox parent)
 {
     Parent = parent;
 }
示例#7
0
文件: Cell.cs 项目: jpx/blazera
 public void AddBoundingBox(EBoundingBox BB)
 {
     EBoundingBoxes.Add(BB);
 }
示例#8
0
文件: Cell.cs 项目: jpx/blazera
 public void RemoveBoundingBox(EBoundingBox BB)
 {
     EBoundingBoxes.Remove(BB);
 }
示例#9
0
 private void RemoveBoundingBox(EBoundingBox BB)
 {
     for (int y = BB.TTop; y < BB.TBottom + 1; ++y)
         for (int x = BB.TLeft; x < BB.TRight + 1; ++x)
             GetCell(x, y).RemoveBoundingBox(BB);
 }
示例#10
0
文件: MapHandler.cs 项目: jpx/blazera
        void AddBoundingBoxToCurrentSelectedObject(EBoundingBox BB)
        {
            Button BBButton = new Button(BoundingBoxCreator.Instance.BBToString(BB), Button.EMode.LabelEffect);
            BBButton.Clicked += new ClickEventHandler(BBButton_Clicked);
            SelectorToolElementEventTextList.AddText(BBButton);

            CurrentSelectedObjectExternalBoundingBoxes.Add(BBButton, BB);
        }