Exemplo n.º 1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked             // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Type.GetHashCode();

                hashCode = hashCode * 59 + Empty.GetHashCode();

                hashCode = hashCode * 59 + Direction.GetHashCode();

                hashCode = hashCode * 59 + RotatorDirection.GetHashCode();

                hashCode = hashCode * 59 + Level.GetHashCode();

                hashCode = hashCode * 59 + Order.GetHashCode();
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if Tile instances are equal
        /// </summary>
        /// <param name="other">Instance of Tile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Tile other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Empty == other.Empty ||
                     Empty.Equals(other.Empty)
                 ) &&
                 (
                     Direction == other.Direction ||
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     RotatorDirection == other.RotatorDirection ||
                     RotatorDirection.Equals(other.RotatorDirection)
                 ) &&
                 (
                     Level == other.Level ||
                     Level.Equals(other.Level)
                 ) &&
                 (
                     Order == other.Order ||
                     Order.Equals(other.Order)
                 ));
        }