示例#1
0
        public GameState InitializeGameState2()
        {
            GameState initState = new GameState();

            //Make Characters
            Character playerCharacter = new Character(PLAYER_NAME, MAX_WIDTH / 2f, MAX_HEIGHT / 2f);

            initState.Player = playerCharacter;
            Random    r = new Random();
            Character prisonerCharacter = new Character(GetRandomPrisonerName(), playerCharacter.X - r.Next(20) + r.Next(20), playerCharacter.Y);

            prisonerCharacter.Hidden = true;
            prisonerCharacter.AddStatus("Alive");
            initState.AddCharacter(prisonerCharacter);

            Location loc = GetNewCharacterLocation(initState);

            Character guardCharacter = new Character(GetRandomPrisonerName(), loc.X, loc.Y);

            guardCharacter.Hidden = true;
            guardCharacter.AddStatus("Alive");
            initState.AddCharacter(guardCharacter);

            guardCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorAlive, guardCharacter, null, null));
            guardCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsReceiverDead, guardCharacter, prisonerCharacter, null));
            guardCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.StateHasLethalItem, null, null, null));

            prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorAlive, prisonerCharacter, null, null));
            prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsReceiverDead, prisonerCharacter, guardCharacter, null));
            prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.StateHasLethalItem, null, null, null));


            return(initState);
        }
示例#2
0
        /// <summary>
        /// Creates a deep copy of the game state.
        /// </summary>
        /// <returns></returns>
        public GameState Clone()
        {
            GameState newState = new GameState();

            // Characters (as structs are copied by value)
            newState.Characters = new List <Character>();
            foreach (Character character in Characters)
            {
                newState.AddCharacter(character.Clone());
            }

            foreach (Item item in Items)
            {
                newState.AddItem(item.Clone());
            }

            foreach (KeyValuePair <string, List <DialogueLine> > kvp in Conversations)
            {
                List <DialogueLine> lines = new List <DialogueLine>();
                foreach (DialogueLine line in kvp.Value)
                {
                    lines.Add(line);
                }
                newState.SetConversation(kvp.Key, lines);
            }

            newState.Player    = this.Player.Clone();
            newState.Intensity = this.Intensity;
            return(newState);
        }
示例#3
0
    /// <summary>
    /// Creates a deep copy of the game state.
    /// </summary>
    /// <returns></returns>
    public GameState Clone()
    {
      GameState newState = new GameState();
      // Characters (as structs are copied by value)
      newState.Characters = new List<Character>();
      foreach (Character character in Characters) {
	newState.AddCharacter(character.Clone());			
      }

      foreach (Item item in Items) {
	newState.AddItem(item.Clone());			
      }

      foreach(KeyValuePair<string,List<DialogueLine>> kvp in Conversations){
	List<DialogueLine> lines = new List<DialogueLine>();
	foreach(DialogueLine line in kvp.Value){
	  lines.Add(line);
	}
	newState.SetConversation(kvp.Key,lines);
      }

      newState.Player = this.Player.Clone();
      newState.Intensity = this.Intensity;
      return newState;
    }
示例#4
0
		public GameState InitializeGameState5() {
			GameState initState = new GameState();
			
			//Make Characters
			Character playerCharacter = new Character(PLAYER_NAME, MAX_WIDTH / 2f, MAX_HEIGHT / 2f);
			initState.Player = playerCharacter;
			
			Random r = new Random ();
			
			Character prisonerCharacter = new Character(GetRandomPrisonerName(), playerCharacter.X -r.Next(20)+r.Next(20), playerCharacter.Y);
			prisonerCharacter.Hidden = true;
			prisonerCharacter.AddStatus("Alive");
			initState.AddCharacter(prisonerCharacter);
			
			Location loc = GetNewCharacterLocation(initState);
			
			Character guardCharacter = new Character(GetRandomGuardName(), loc.X, loc.Y);
			guardCharacter.Hidden = true;
			guardCharacter.AddStatus("Alive");
			initState.AddCharacter(guardCharacter);
			
			Location loc2 = GetNewCharacterLocation(initState);
			
			Character prisonerCharacter2 = new Character(GetRandomPrisonerName(), loc2.X, loc2.Y);
			prisonerCharacter2.Hidden = true;
			prisonerCharacter2.AddStatus("Alive");
			initState.AddCharacter(prisonerCharacter2);
			
			guardCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorAlive, guardCharacter, null, null));
			guardCharacter.Goals.Add (new CharacterGoal (ConditionLibrary.IsReceiverDead, guardCharacter, prisonerCharacter, null));
			guardCharacter.Goals.Add (new CharacterGoal (ConditionLibrary.StateHasLethalItem, null, null, null));

			prisonerCharacter2.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorAlive, prisonerCharacter2, null, null));
			prisonerCharacter2.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorMobile, prisonerCharacter2, null, null));
			prisonerCharacter2.Goals.Add(new CharacterGoal(ConditionLibrary.DoesStateHaveLiberatingItem, null, null, null));
			prisonerCharacter2.Goals.Add(new CharacterGoal(ConditionLibrary.DoesStateNotHaveLethalItem, null, null, null));

			
			prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorAlive, prisonerCharacter, null, null));
			prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.IsInstigatorMobile, prisonerCharacter, null, null));
			prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.DoesStateHaveLiberatingItem, null, null, null));
			prisonerCharacter.Goals.Add(new CharacterGoal(ConditionLibrary.DoesStateNotHaveLethalItem, null, null, null));
			
			return initState;
		}