Example #1
0
    //TODO, mff consider what is happening in GameManager, Character and Observation, in regards to this check
    public virtual bool CheckObservation(int currentTime)
    {
        int observationCount = observations.Count;

//		if(observationCount <= 0)
//			return true;

        for (int i = 0; i < observationCount; i++)
        {
            Observation observation = observations[i];

            if (observation.time == currentTime)
            {
                if (observation.CheckObservation(this) == false)
                {
                    return(false);
                }

//				//----// Characters //----//
//				Location observationLocation = observation.location;
//				List<Character> currentCharacters = new List<Character>(observationLocation.characters);
//				for (int j = 0, count = observation.characters.Count; j < count; j++)
//				{
//					Character expectedCharacter = observation.characters[j];
//
//					if(currentCharacters.Remove(expectedCharacter) == false)
//					{
//						GameManager.paradox = new Paradox(observation, this.GetName()+" did not see "+expectedCharacter.GetName()+" in the "+observationLocation.name+", Paradox!");
//						return false;
//					}
//				}
//
//				int unexpectedCharactersCount = currentCharacters.Count;
//
//				if(unexpectedCharactersCount > 0)
//				{
//					string paradoxMessage = this.GetName()+" did not expect to see ";
//
//					for (int j = 0; j < unexpectedCharactersCount; j++)
//					{
//						if(j > 0)
//							paradoxMessage += " and ";
//
//						paradoxMessage += currentCharacters[j].GetName();
//					}
//
//					paradoxMessage += " in the "+observationLocation.name+", Paradox!";
//
//					GameManager.paradox = new Paradox(observation, paradoxMessage);
//
//					return false;
//				}
//
//				//----// Items //----//
//				List<Item> currentItems = new List<Item>(observationLocation.items);
//
//				for (int j = 0, count = observation.items.Count; j < count; j++)
//				{
//					Item expectedItem = observation.items[j];
//					if(currentItems.Remove(expectedItem) == false)
//					{
//						GameManager.paradox = new Paradox(observation, this.GetName()+" did not see "+expectedItem+" in the "+observationLocation.name+", Paradox!");
//						return false;
//					}
//				}
//
//				int unexpectedItemsCount = currentItems.Count;
//				if(unexpectedItemsCount > 0)
//				{
//					string paradoxMessage = this.GetName()+" saw ";
//
//					for (int j = 0; j < unexpectedItemsCount; j++)
//					{
//						if(j > 0)
//							paradoxMessage += " and ";
//
//						paradoxMessage += currentItems[j].ToString();
//					}
//
//					paradoxMessage += " in the "+observationLocation.name+", Paradox!";
//
//					GameManager.paradox = new Paradox(observation, paradoxMessage);
//					return false;
//				}
            }
        }

        return(true);
    }