Beispiel #1
0
        public AnimationMapEffect()
            : base()
        {
            DrawOrder = BlazeraLib.DrawOrder.Normal;

            OnMove += new MoveEventHandler(AnimationMapEffect_OnMove);
        }
Beispiel #2
0
        public AnimationMapEffect(AnimationMapEffect copy)
            : base(copy)
        {
            Effect = new Animation(copy.Effect);
            SoundName = copy.SoundName;

            OnMove += new MoveEventHandler(AnimationMapEffect_OnMove);
        }
Beispiel #3
0
            public static void EndMoveEvent(IAsyncResult iar)
            {
                System.Runtime.Remoting.Messaging.AsyncResult ar = (System.Runtime.Remoting.Messaging.AsyncResult)iar;
                object           o             = ar.AsyncDelegate;
                MoveEventHandler invokedMethod = (MoveEventHandler)ar.AsyncDelegate;

                try { invokedMethod.EndInvoke(iar); }
                catch { }
            }
Beispiel #4
0
        public void FireMoveEvent()
        {
            MoveEventHandler handler = MoveEvent;

            if (handler != null)
            {
                handler(this, null);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Установить обработчик MoveEvent
 /// </summary>
 /// <param name="handler"></param>
 public void SetFiguresMoveListener(MoveEventHandler handler)
 {
     foreach (Figure fig in pl1.alivefigures)
     {
         fig.MoveEvent += handler;
     }
     foreach (Figure fig in pl2.alivefigures)
     {
         fig.MoveEvent += handler;
     }
 }
        protected virtual void InvokeMove(EventArgs e)
        {
            GetLocation();

            MoveEventHandler h = Move;

            if (h != null)
            {
                h(this, e);
            }
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        internal static void ApplyBindingAction(object ds, Action <bool> applyAction)
        {
            var rs = ds as ADORecordSetHelper;

            if (rs != null)
            {
                MoveEventHandler         onWillMove     = null;
                MoveCompleteEventHandler onMoveComplete = null;
                //Events.After
                EventHandler onAfterQuery = null;
                if (onWillMove == null)
                {
                    onWillMove = (sender, args) =>
                    {
                        var theRS = sender as ADORecordSetHelper;
                        if (theRS != null)
                        {
                            if (theRS.CurrentRow != null)
                            {
                                applyAction(false);
                            }
                        }
                    };
                }

                if (onMoveComplete == null)
                {
                    onMoveComplete = (sender, args) => applyAction(true);
                }
                if (onAfterQuery == null)
                {
                    onAfterQuery =
                        (sender, args) =>
                        applyAction(true);
                }
                rs.WillMove     -= onWillMove;
                rs.WillMove     += onWillMove;
                rs.MoveComplete -= onMoveComplete;
                rs.MoveComplete += onMoveComplete;
                rs.AfterQuery   -= onAfterQuery;
                rs.AfterQuery   += onAfterQuery;
                return;
            }
            throw new ArgumentException("SurrogateRegisterBinding object was expected to by of UpgradeHelpers.DB.ADO.ADORecordSetHelper type");
        }
Beispiel #9
0
 public void Validate( int a)
 {
     if (a <= 50)
     {
         position = a;
     }
     else
     {
         // callback tal que, se a nova posição for maior que 50, então é inválida
         Moved += new MoveEventHandler(this.Callback);
     }
 }
Beispiel #10
0
 /// <summary>
 /// Установить обработчик MoveEvent
 /// </summary>
 /// <param name="handler"></param> 
 public void SetFiguresMoveListener(MoveEventHandler handler)
 {
     foreach (Figure fig in pl1.alivefigures)
         fig.MoveEvent += handler;
     foreach (Figure fig in pl2.alivefigures)
         fig.MoveEvent += handler;
 }
Beispiel #11
0
 //CoRoutines
 IEnumerator MoveDuringState(Vector2 speed, MoveEventHandler.CharacterState state)
 {
     //yield return new WaitForEndOfFrame();
     isMovingInState = true;
     float currentTime = 0;
     while (state == moveHandler.GetCurrentState())
     {
         currentTime = currentTime + Time.deltaTime;
         float xDisplacement = speed.x * Time.deltaTime;
         float yDisplacement = speed.y * Time.deltaTime;
         this.transform.position = new Vector3(xDisplacement + this.transform.position.x,
                                               yDisplacement + this.transform.position.y,
                                               this.transform.position.z);
         yield return new WaitForEndOfFrame();
     }
     isMovingInState = false;
 }
Beispiel #12
0
    protected void Initialize()
    {
        health = maxHealth;
        moveHandler = this.gameObject.GetComponent<MoveEventHandler>();
        gm = (GameManager)GameObject.Find("GameManager").GetComponent<GameManager>();
        rightArm = this.gameObject.transform.FindChild("torso").FindChild("upperRightArm");

        this.rigidbodyTwoD = this.gameObject.GetComponent<Rigidbody2D>();
        //This is backwards since our prefab is facing left by default
        if (this.transform.right.x > 0)
        {
            isFacingLeft = true;
        }
        else
        {
            isFacingLeft = false;
        }
    }