コード例 #1
0
 public void UpdateVelocitie(Moon other)
 {
     if (other != this)
     {
         float dx = other.Position.X - Position.X;
         float dy = other.Position.Y - Position.Y;
         float dz = other.Position.Z - Position.Z;
         Velocity += new Vector3(dx == 0 ? 0 : Math.Sign(dx),
                                 dy == 0 ? 0 : Math.Sign(dy),
                                 dz == 0 ? 0 : Math.Sign(dz));
     }
 }
コード例 #2
0
 public override bool Equals(object obj)
 {
     if (obj == null)
     {
         return(false);
     }
     else if (obj is Moon)
     {
         Moon moon = (Moon)obj;
         return(Position.X == moon.Position.X &&
                Position.Y == moon.Position.Y &&
                Position.Z == moon.Position.Z &&
                Velocity.X == moon.Velocity.X &&
                Velocity.Y == moon.Velocity.Y &&
                Velocity.Z == moon.Velocity.Z);
     }
     return(base.Equals(obj));
 }