Exemplo n.º 1
0
 protected override void Write(NWriter wtr)
 {
     wtr.Write((byte)EffectType);
     wtr.Write(TargetObjectId);
     Pos1.Write(wtr);
     Pos2.Write(wtr);
     Color.Write(wtr);
 }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = 1867150729;
                if (Pos1.CompareTo(Pos2) > 0)
                {
                    hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Pos1);

                    hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Pos2);
                }
                else
                {
                    hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Pos2);

                    hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Pos1);
                }
                return(hashCode);
            }
        }
Exemplo n.º 3
0
 public static bool operator>=(DiffViewPosition Pos1, DiffViewPosition Pos2)
 {
     return(Pos1.CompareTo(Pos2) >= 0);
 }
Exemplo n.º 4
0
 public static bool operator!=(DiffViewPosition Pos1, DiffViewPosition Pos2)
 {
     return(!Pos1.Equals(Pos2));
 }
Exemplo n.º 5
0
 public IDiagram MovedBy(int x, int y)
 {
     return(new Triangle(Pos0.MovedBy(x, y), Pos1.MovedBy(x, y), Pos2.MovedBy(x, y)));
 }
Exemplo n.º 6
0
 public void MoveBy(int x, int y)
 {
     Pos0 = Pos0.MovedBy(x, y);
     Pos1 = Pos1.MovedBy(x, y);
     Pos2 = Pos2.MovedBy(x, y);
 }
Exemplo n.º 7
0
        /* -- Área para el método que utiliza los datos proporcionados por Kinect -- */
        /// <summary>
        /// Método que realiza las manipulaciones necesarias sobre el Skeleton trazado
        /// </summary>
        private void usarSkeleton(Skeleton skeleton)
        {
            Joint joint1 = skeleton.Joints[JointType.HandRight];
            /////////////
            Joint joint2 = skeleton.Joints[JointType.HandLeft];
            ////////////
            ////////////
            Joint joint3 = skeleton.Joints[JointType.Head];
            ////////////
            ////////////
            Joint joint4 = skeleton.Joints[JointType.KneeRight];
            ////////////
            ////////////
            Joint joint5 = skeleton.Joints[JointType.KneeLeft];
            ////////////
            ////////////
            Joint joint6 = skeleton.Joints[JointType.FootRight];
            ////////////
            ////////////
            Joint joint7 = skeleton.Joints[JointType.FootLeft];

            ////////////
            //	Si	el	Joint	está	listo	obtener	las	coordenadas
            if (joint1.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint1.Position);
                dMano_X     = joint_Point.X;
                dMano_Y     = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero.SetValue(Canvas.TopProperty, dMano_Y + 35);
                Puntero.SetValue(Canvas.LeftProperty, dMano_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////
            if (joint2.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint2.Position);
                iMano_X     = joint_Point.X;
                iMano_Y     = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero1.SetValue(Canvas.TopProperty, iMano_Y + 35);
                Puntero1.SetValue(Canvas.LeftProperty, iMano_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////////////////
            if (joint3.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint3.Position);
                Cabeza_X    = joint_Point.X;
                Cabeza_Y    = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero3.SetValue(Canvas.TopProperty, Cabeza_Y + 35);
                Puntero3.SetValue(Canvas.LeftProperty, Cabeza_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////////////////
            //	Si	el	Joint	está	listo	obtener	las	coordenadas
            if (joint4.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint4.Position);
                dRodilla_X  = joint_Point.X;
                dRodilla_Y  = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero4.SetValue(Canvas.TopProperty, dRodilla_Y + 35);
                Puntero4.SetValue(Canvas.LeftProperty, dRodilla_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////
            //	Si	el	Joint	está	listo	obtener	las	coordenadas
            if (joint5.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint5.Position);
                iRodilla_X  = joint_Point.X;
                iRodilla_Y  = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero5.SetValue(Canvas.TopProperty, iRodilla_Y + 35);
                Puntero5.SetValue(Canvas.LeftProperty, iRodilla_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////
            //	Si	el	Joint	está	listo	obtener	las	coordenadas
            if (joint6.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint6.Position);
                dPie_X      = joint_Point.X;
                dPie_Y      = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero6.SetValue(Canvas.TopProperty, dPie_Y + 35);
                Puntero6.SetValue(Canvas.LeftProperty, dPie_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////
            //	Si	el	Joint	está	listo	obtener	las	coordenadas
            if (joint7.TrackingState == JointTrackingState.Tracked)
            {
                //	Obtiene	las	coordenadas	(x,	y)	del	Joint
                joint_Point = this.SkeletonPointToScreen(joint7.Position);
                iPie_X      = joint_Point.X;
                iPie_Y      = joint_Point.Y;
                //Emplea	las	coordenadas	del	Joint	para	mover	la	elipse
                Puntero7.SetValue(Canvas.TopProperty, iPie_Y + 35);
                Puntero7.SetValue(Canvas.LeftProperty, iPie_X + 30);
                //	Obtiene	el	Id	de	la	persona	mapeada
                LID.Content = skeleton.TrackingId;
            }
            ////////////////

            if (Posicion() && Pase)
            {
                EscPunte(true);
                Bandera.Fill          = Brushes.Green;
                MainCanvas.Background = Brushes.Transparent;
                Pos1.Height           = 200;
                Pos1.SetValue(Canvas.TopProperty, 325.0);
                Pos1.SetValue(Canvas.LeftProperty, 600.0);
                timer.IsEnabled = true;
                puntos++;
            }
            else if (Pase)
            {
                Bandera.Fill = Brushes.Red;
            }
            else if (Pase1)
            {
                EscPunte(false);
                Bandera.Fill          = Brushes.Red;
                MainCanvas.Background = Brushes.White;
                Pos1.Visibility       = Visibility.Hidden;
                Pos2.Visibility       = Visibility.Visible;
                Progreso.Value        = 0.0;
                Progreso.Visibility   = Visibility.Hidden;
                Pase1 = false;
            }
            else if (Posicion1() && Pase2)
            {
                EscPunte(true);
                Bandera.Fill          = Brushes.Green;
                MainCanvas.Background = Brushes.Transparent;
                Pos2.Height           = 200;
                Pos2.SetValue(Canvas.TopProperty, 325.0);
                Pos2.SetValue(Canvas.LeftProperty, 425.0);
                timer2.IsEnabled = true;
                puntos++;
            }
            else if (Pase2)
            {
                Bandera.Fill = Brushes.Red;
            }
            else
            {
                EscPunte(false);
                Bandera.Fill          = Brushes.Black;
                MainCanvas.Background = Brushes.Black;
                Pos2.Visibility       = Visibility.Hidden;
                Progreso1.Visibility  = Visibility.Hidden;
                Puntuacion.Content    = "Tu puntuacion es: " + puntos.ToString();
            }
        }
Exemplo n.º 8
0
        public bool Equals(Quest q)
        {
            if (q is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, q))
            {
                return(true);
            }

            return(QuestType.Equals(q.QuestType) && Players.SequenceEqual(q.Players) && Pos1.Equals(q.Pos1) &&
                   Pos2.Equals(q.Pos2) && QuestTime.Equals(q.QuestTime) && QuestText.Equals(q.QuestText) &&
                   Stage.Equals(q.Stage));
        }
Exemplo n.º 9
0
        public override void Draw()
        {
            if (Math.Sqrt(Game.PlayerPed.Position.DistanceToSquared((Pos1 + Pos2) / 2)) > Math.Sqrt(Pos1.DistanceToSquared(Pos2)) * 5)
            {
                return;
            }

            Vector3 center = new Vector3 {
                X = (Pos1.X + Pos2.X) / 2, Y = (Pos1.Y + Pos2.Y) / 2, Z = (Pos1.Z + Pos2.Z) / 2
            };
            Matrix3x3 rot = Matrix3x3.RotationZ(Angle);

            Vector3 A = Pos1;
            Vector3 B = new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos1.Z
            };
            Vector3 C = new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos1.Z
            };
            Vector3 D = new Vector3 {
                X = Pos2.X, Y = Pos2.Y, Z = Pos1.Z
            };
            Vector3 E = new Vector3 {
                X = Pos1.X, Y = Pos1.Y, Z = Pos2.Z
            };
            Vector3 F = new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos2.Z
            };
            Vector3 G = new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos2.Z
            };
            Vector3 H = Pos2;

            A = A - center;
            B = B - center;
            C = C - center;
            D = D - center;
            E = E - center;
            F = F - center;
            G = G - center;
            H = H - center;

            A = Vector3.Transform(A, rot);
            B = Vector3.Transform(B, rot);
            C = Vector3.Transform(C, rot);
            D = Vector3.Transform(D, rot);
            E = Vector3.Transform(E, rot);
            F = Vector3.Transform(F, rot);
            G = Vector3.Transform(G, rot);
            H = Vector3.Transform(H, rot);

            A = A + center;
            B = B + center;
            C = C + center;
            D = D + center;
            E = E + center;
            F = F + center;
            G = G + center;
            H = H + center;

            World.DrawLine(A, B, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(A, C, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(A, E, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(H, F, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(H, G, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(H, D, System.Drawing.Color.FromArgb(255, 0, 0));

            World.DrawLine(D, B, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(D, C, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(G, B, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(G, E, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(F, E, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(F, C, System.Drawing.Color.FromArgb(255, 0, 0));
        }
Exemplo n.º 10
0
        public override void Draw()
        {
            if (Math.Sqrt(Game.PlayerPed.Position.DistanceToSquared((Pos1 + Pos2) / 2)) > Math.Sqrt(Pos1.DistanceToSquared(Pos2)) * 5)
            {
                return;
            }

            World.DrawLine(Pos1, new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(Pos1, new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(Pos1, new Vector3 {
                X = Pos1.X, Y = Pos1.Y, Z = Pos2.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(Pos2, new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos2.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(Pos2, new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos2.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(Pos2, new Vector3 {
                X = Pos2.X, Y = Pos2.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));

            World.DrawLine(new Vector3 {
                X = Pos2.X, Y = Pos2.Y, Z = Pos1.Z
            }, new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(new Vector3 {
                X = Pos2.X, Y = Pos2.Y, Z = Pos1.Z
            }, new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos2.Z
            }, new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(new Vector3 {
                X = Pos2.X, Y = Pos1.Y, Z = Pos2.Z
            }, new Vector3 {
                X = Pos1.X, Y = Pos1.Y, Z = Pos2.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos2.Z
            }, new Vector3 {
                X = Pos1.X, Y = Pos1.Y, Z = Pos2.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
            World.DrawLine(new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos2.Z
            }, new Vector3 {
                X = Pos1.X, Y = Pos2.Y, Z = Pos1.Z
            }, System.Drawing.Color.FromArgb(255, 0, 0));
        }
Exemplo n.º 11
0
 public override int GetHashCode()
 {
     return(String.GetHashCode() ^ Pos1.GetHashCode() ^ Pos2.GetHashCode());
 }