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

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

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

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

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

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

            return
                ((
                     Entity == other.Entity ||
                     Entity.Equals(other.Entity)
                     ) &&
                 (
                     Direction == other.Direction ||
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     MovementAmmount == other.MovementAmmount ||
                     MovementAmmount.Equals(other.MovementAmmount)
                 ) &&
                 (
                     Rotation == other.Rotation ||
                     Rotation.Equals(other.Rotation)
                 ) &&
                 (
                     RotationTimes == other.RotationTimes ||
                     RotationTimes.Equals(other.RotationTimes)
                 ) &&
                 (
                     From == other.From ||
                     From != null &&
                     From.Equals(other.From)
                 ) &&
                 (
                     To == other.To ||
                     To != null &&
                     To.Equals(other.To)
                 ));
        }