Ejemplo n.º 1
0
        public bool Equals(Goal anotherGoal)
        {
            if (anotherGoal == null)
            {
                return(false);
            }

            bool goalTypeIsLocationEquals          = (goalTypeIsLocation == anotherGoal.goalTypeIsLocation);
            bool goalTypeIsLocationReferenceEquals = object.ReferenceEquals(goalTypeIsLocation, anotherGoal.goalTypeIsLocation);

            bool goalTypeIsStatusEquals          = (goalTypeIsStatus == anotherGoal.goalTypeIsStatus);
            bool goalTypeIsStatusReferenceEquals = object.ReferenceEquals(goalTypeIsStatus, anotherGoal.goalTypeIsStatus);

            bool goalTypeIsPossessionEquals          = (goalTypeIsPossession == anotherGoal.goalTypeIsPossession);
            bool goalTypeIsPossessionReferenceEquals = object.ReferenceEquals(goalTypeIsPossession, anotherGoal.goalTypeIsPossession);

            bool goalStateEquals          = goalState.Equals(anotherGoal.goalState);
            bool goalStateReferenceEquals = object.ReferenceEquals(goalState, anotherGoal.goalState);

            bool goalTypeIsLocationGlobal   = goalTypeIsLocationEquals || goalTypeIsLocationReferenceEquals;
            bool goalTypeIsStatusGlobal     = goalTypeIsStatusEquals || goalTypeIsStatusReferenceEquals;
            bool goalTypeIsPossessionGlobal = goalTypeIsPossessionEquals || goalTypeIsPossessionReferenceEquals;
            bool goalStateGlobal            = goalStateEquals || goalStateReferenceEquals;

            bool equal = goalTypeIsLocationGlobal && goalTypeIsStatusGlobal && goalTypeIsPossessionGlobal && goalStateGlobal;

            return(equal);
        }
Ejemplo n.º 2
0
        /*public override bool Equals (object obj)
         * {
         *  return Equals(obj as StoryNode);
         * }*/

        public bool Equals(StoryNode anotherNode)
        {
            if (anotherNode == null)
            {
                return(false);
            }

            bool worldStateEquals          = worldState.Equals(anotherNode.worldState);
            bool worldStateReferenceEquals = object.ReferenceEquals(worldState, anotherNode.worldState);

            bool playerIsActiveEquals = (playerIsActive == anotherNode.playerIsActive);

            bool activeAgentStaticEquals          = activeAgent.Key.Equals(anotherNode.activeAgent.Key);
            bool activeAgentStaticReferenceEquals = object.ReferenceEquals(activeAgent.Key, anotherNode.activeAgent.Key);

            bool activeAgentDynamicEquals          = activeAgent.Value.Equals(anotherNode.activeAgent.Value);
            bool activeAgentDynamicReferenceEquals = object.ReferenceEquals(activeAgent.Value, anotherNode.activeAgent.Value);

            bool worldStateGlobal         = worldStateEquals || worldStateReferenceEquals;
            bool activeAgentStaticGlobal  = activeAgentStaticEquals || activeAgentStaticReferenceEquals;
            bool activeAgentDynamicGlobal = activeAgentDynamicEquals || activeAgentDynamicReferenceEquals;

            bool equal = worldStateGlobal /*&& playerIsActiveEquals && activeAgentStaticGlobal && activeAgentDynamicGlobal*/;

            return(equal);
        }