Exemple #1
0
        public static void registerCoordinateEvent(AreaEvent areaEvent)
        {
            Event newCoordinateEvent = new Event(0);

            newCoordinateEvent.setAction(() =>
            {
                bool standingStill = areaEvent.getPlayer().getSprites().getPrimarySprite() == -1 && areaEvent.getPlayer().getSprites().getSecondarySprite() == -1;
                if (areaEvent.getPlayer().getDistanceEvent() == null || !areaEvent.getPlayer().getDistanceEvent().Equals(areaEvent))
                {
                    newCoordinateEvent.stop();
                    return;
                }
                if (standingStill)
                {
                    if (areaEvent.inArea())
                    {
                        areaEvent.run();
                        newCoordinateEvent.stop();
                        areaEvent.setDistanceEventNull();
                        return;
                    }
                }
                newCoordinateEvent.setTick(500);
            });
            registerEvent(newCoordinateEvent);
        }