/// <summary>
        /// Devices the arrived.
        /// </summary>
        /// <param name="sender">The sender.</param>
        private void DeviceArrived(ProximityDevice sender)
        {
            //if (sender == this.device)
            //{
            //    System.Diagnostics.Debug.WriteLine("Sender is the same NFC device.");
            //}

            //this.inRange.Invoke<INfcDevice>(this, new NfcDevice(sender));
            InRange.Invoke <INfcDevice>(this, this);
        }
    public override bool Update()
    {
        GameObject goA = (GameObject)A.Value;
        GameObject goB = (GameObject)B.Value;

        if (goA == null)
        {
            EB.Debug.LogError("SequenceCondition_Distance: A is null");
            return(false);
        }

        if (goB == null)
        {
            EB.Debug.LogError("SequenceCondition_Distance: B is null");
            return(false);
        }

        var difference = goA.transform.position - goB.transform.position;

        if (OnlyXZ)
        {
            difference.y = 0;
        }

        float distance = difference.magnitude;

        if (distance <= Distance)
        {
            InRange.Invoke();
        }
        else
        {
            OutOfRange.Invoke();
        }
        return(false);
    }
Exemple #3
0
 /// <summary>
 ///     Creates the ndef message.
 /// </summary>
 /// <param name="e">The e.</param>
 /// <returns>NdefMessage.</returns>
 public NdefMessage CreateNdefMessage(NfcEvent e)
 {
     InRange.Invoke <INfcDevice>(this, this);
     return(new NdefMessage(_published.Values.ToArray()));
 }
Exemple #4
0
        public override List <Point> GetMoves()
        {
            //List of moves to be returned
            List <Point> moves = new List <Point>();


            //Iterator items
            Point curPoint;
            Piece curPiece;

            //Row and collumn of this piece
            int row = this.loc.X,
                col = this.loc.Y;

            //If stops[n] == true, stop going in a certain direction
            bool[] stops;

            //y-axis
            stops = new bool[2];
            for (int rMod = 1; rMod < 8; rMod++)
            {
                //if stop == 0, check positive direction
                //else, check negative direction
                for (int stop = 0; stop < 2; stop++)
                {
                    //if stops[stop] = true, don't check; stop
                    if (!stops[stop])
                    {
                        int dir = (stop == 0) ? 1 : -1;
                        curPoint = new Point(row + rMod * dir, col);
                        if (InRange.Invoke(curPoint))
                        {
                            curPiece = Chess.GetBoard().GetPiece(curPoint);
                            if (this.Beats(this, curPiece))
                            {
                                moves.Add(curPoint);
                                stops[stop] = (curPiece.GetColor() != ' ');
                            }
                            else
                            {
                                stops[stop] = true;
                            }
                        }
                        else
                        {
                            stops[stop] = true;
                        }
                    }
                }
            }
            //x-axis
            stops = new bool[2];
            for (int cMod = 1; cMod < 8; cMod++)
            {
                //if stop == 0, check positive direction
                //else, check negative direction
                for (int stop = 0; stop < 2; stop++)
                {
                    //if stops[stop] == 0, check positive direction
                    //else, check negative direction
                    if (!stops[stop])
                    {
                        int dir = (stop == 0) ? 1 : -1;
                        curPoint = new Point(row, col + cMod * dir);
                        if (InRange(curPoint))
                        {
                            curPiece = Chess.GetBoard().GetPiece(curPoint);
                            if (this.Beats(this, curPiece))
                            {
                                moves.Add(curPoint);
                                stops[stop] = (curPiece.GetColor() != ' ');
                            }
                            else
                            {
                                stops[stop] = true;
                            }
                        }
                        else
                        {
                            stops[stop] = true;
                        }
                    }
                }
            }
            return(moves);
        }
 internal void RaiseInRange()
 {
     InRange?.Invoke(this, new WiimoteRangeEventArgs(this, true));
 }
Exemple #6
0
 private static void RaiseInRange(Wiimote wiimote)
 {
     Debug.WriteLine($"{wiimote} In Range");
     InRange?.Invoke(null, new WiimoteRangeEventArgs(wiimote, true));
     wiimote.RaiseInRange();
 }