Esempio n. 1
0
 /// <summary>
 /// Determines whether two Cell instances are equal
 /// </summary>
 /// <param name="other">The Cell to compare this instance to</param>
 /// <returns>True if the instances are equal; False otherwise</returns>
 /// <exception cref="NullReferenceException">Thrown if .Equals is invoked on null Cell</exception>
 protected bool Equals(Cell other)
 {
     if (other == null)
     {
         return(false);
     }
     return(X == other.X && Y == other.Y && IsTransparent.Equals(other.IsTransparent) && IsWalkable.Equals(other.IsWalkable) && IsInFov.Equals(other.IsInFov) && IsExplored.Equals(other.IsExplored));
 }
Esempio n. 2
0
 /// <summary>
 /// Gets the hash code for this object which can help for quick checks of equality
 /// or when inserting this Cell into a hash-based collection such as a Dictionary or Hashtable
 /// </summary>
 /// <returns>An integer hash used to identify this Cell</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = X;
         hashCode = (hashCode * 397) ^ Y;
         hashCode = (hashCode * 397) ^ IsTransparent.GetHashCode();
         hashCode = (hashCode * 397) ^ IsWalkable.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Point.X;
         hashCode = (hashCode * 397) ^ Point.Y;
         hashCode = (hashCode * 397) ^ IsTransparent.GetHashCode();
         hashCode = (hashCode * 397) ^ IsWalkable.GetHashCode();
         hashCode = (hashCode * 397) ^ IsInFov.GetHashCode();
         hashCode = (hashCode * 397) ^ IsExplored.GetHashCode();
         return(hashCode);
     }
 }