//////////////////////
        /* HASHCODE SECTION */
        //////////////////////

        public override int GetHashCode()
        {
            if (hasHashCode && hashCode != 0)
            {
                return(hashCode);
            }

            int hashcode = 18;

            hashcode = hashcode * 42 + entraping.GetHashCode();
            if (whom != null)
            {
                whom.ClearHashCode();
                hashcode = hashcode * 42 + whom.GetHashCode();
            }
            if (where != null)
            {
                where.ClearHashCode();
                hashcode = hashcode * 42 + where.GetHashCode();
            }

            hashCode    = hashcode;
            hasHashCode = true;

            return(hashcode);
        }
Exemple #2
0
        //////////////////////
        /* HASHCODE SECTION */
        //////////////////////

        public override int GetHashCode()
        {
            if (hasHashCode && hashCode != 0)
            {
                return(hashCode);
            }

            int hashcode = 18;

            agentInfo.ClearHashCode();
            hashcode = hashcode * 42 + agentInfo.GetHashCode();
            hashcode = hashcode * 42 + alive.GetHashCode();
            hashCode = hashcode * 42 + scared.GetHashCode();
            if (angryAt != null)
            {
                angryAt.ClearHashCode();
                hashcode = hashcode * 42 + angryAt.GetHashCode();
            }
            if (wantsToGo != null)
            {
                wantsToGo.ClearHashCode();
                hashcode = hashcode * 42 + wantsToGo.GetHashCode();
            }
            if (foundEvidence != null)
            {
                foundEvidence.ClearHashCode();
                hashcode = hashcode * 42 + foundEvidence.GetHashCode();
            }
            if (exploredRooms != null)
            {
                foreach (var explRoom in exploredRooms)
                {
                    explRoom.ClearHashCode();
                    hashcode = hashcode * 42 + explRoom.GetHashCode();
                }
            }
            if (wantToEntrap != null)
            {
                wantToEntrap.ClearHashCode();
                hashcode = hashcode * 42 + wantToEntrap.GetHashCode();
            }
            if (talkingWith != null)
            {
                talkingWith.ClearHashCode();
                hashcode = hashcode * 42 + talkingWith.GetHashCode();
            }
            hashcode = hashcode + skipedTurns;

            hashCode    = hashcode;
            hasHashCode = true;

            return(hashcode);
        }