public Dialogue() { EndProgressPreReq= new StoryProgress(); TheResponses = new List<string>(); ResponseEndingProg = new List<StoryProgress>(); ResponseEndingPlayerStat = new List<int>(); }
public override void Init() { Console.WriteLine ("PlayState initialized"); //TODO: load the backgrounds and buttons and stuff here playBG = new Object("game"); // seting up the new player player = new Player("YorkMay4","YorkMayCasual4",65,20,32f * 4); player.Position = new Vector2(64,630); string thisLevel = fileManager.LoadPlayer(); CurrentLevel = fileManager.LoadLevel(thisLevel); CurrentProgress = new StoryProgress(); }
public static StoryProgress operator +(StoryProgress s1,StoryProgress s2) { StoryProgress sret = new StoryProgress(); sret.Cripple = s1.Cripple +s2.Cripple; sret.Foodtruck = s1.Foodtruck +s2.Foodtruck; sret.Insane = s1.Insane +s2.Insane; sret.Slayer = s1.Slayer +s2.Slayer; sret.Suicide = s1.Suicide +s2.Suicide; sret.Tunnel = s1.Tunnel +s2.Tunnel; return sret; }
/// <summary> /// Loads the character by name passed through as an argument /// </summary> /// <returns> /// The character. /// </returns> /// <param name='CharacterName'> /// Character name. /// </param> public AI LoadCharacter(String CharacterName) { int NumberOfLines = 0; string line; AI ReturnedCharacter; System.IO.StreamReader file; // Read the file and display it line by line. try { file = new System.IO.StreamReader (CharacterDirectory + CharacterName + ".save"); } catch (Exception e) { file = new System.IO.StreamReader (CharacterDirectory + CharacterName + ".txt"); } // temporary data that will be used to add objects to the level string tempFileName; Vector2 tempPosition; int tempDisposision; bool tempIsGuard = false; bool tempIsHooker = false; // reads in data for object position etc tempFileName = file.ReadLine (); NumberOfLines++; ReturnedCharacter = new AI (tempFileName); // reads in the characters name ReturnedCharacter.Name = ((FileStream) file.BaseStream).Name; ReturnedCharacter.Name = Path.GetFileName(ReturnedCharacter.Name); ReturnedCharacter.Name = ReturnedCharacter.Name.Remove(ReturnedCharacter.Name.Length-4,4); // now load in the stats line = file.ReadLine (); tempDisposision = Convert.ToInt32 (line); ReturnedCharacter.PlayerDisposition = tempDisposision; NumberOfLines++; //their hook line = file.ReadLine (); NumberOfLines++; //if guard line = file.ReadLine (); tempIsGuard = Convert.ToBoolean (line); ReturnedCharacter.IsGuard = tempIsGuard; NumberOfLines++; //if hooker line = file.ReadLine (); tempIsHooker = Convert.ToBoolean (line); if (tempIsHooker) { ReturnedCharacter = new AI (tempFileName, 11, 2, 128f, true); ReturnedCharacter.PlayerDisposition = tempDisposision; ReturnedCharacter.IsGuard = tempIsGuard; } else { ReturnedCharacter = new AI (tempFileName, 65, 2, 128f, false); ReturnedCharacter.PlayerDisposition = tempDisposision; ReturnedCharacter.IsGuard = tempIsGuard; } ReturnedCharacter.IsHooker = tempIsHooker; NumberOfLines++; //hit points,speed,damage,dodge,block line = file.ReadLine(); ReturnedCharacter.HitPoints = Convert.ToInt32(line); NumberOfLines++; line = file.ReadLine(); ReturnedCharacter.HitSpeed =Convert.ToInt32(line); NumberOfLines++; line = file.ReadLine(); ReturnedCharacter.HitDamage = Convert.ToInt32(line); NumberOfLines++; line = file.ReadLine(); ReturnedCharacter.DodgeSpeed = Convert.ToInt32(line); NumberOfLines++; line = file.ReadLine(); ReturnedCharacter.BlockSpeed = Convert.ToInt32(line); NumberOfLines++; // now all the dialogue line = file.ReadLine(); ReturnedCharacter.NoDialogueLine = line; NumberOfLines++; line = file.ReadLine(); int numDialogue = Convert.ToInt32(line ); NumberOfLines++; for (int d = 0; d < numDialogue; d++) { // the temp dialogue thing AI.Dialogue tempDialogue = new AI.Dialogue(); //ret.Dialogues.Add // this gets all the data out of the file line= file.ReadLine(); string[] DialogueData = line.Split(';'); NumberOfLines++; // ending modifier if ( StoryProgress.enum_EndingProgress.NONE.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.NONE; } if ( StoryProgress.enum_EndingProgress.FOODTRUCK.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.FOODTRUCK; tempDialogue.EndProgressPreReq.Tunnel = Convert.ToInt32(DialogueData[1]); } if ( StoryProgress.enum_EndingProgress.INSANE.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.INSANE; tempDialogue.EndProgressPreReq.Insane = Convert.ToInt32(DialogueData[1]); } if ( StoryProgress.enum_EndingProgress.CRIPPLE.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.CRIPPLE; tempDialogue.EndProgressPreReq.Cripple = Convert.ToInt32(DialogueData[1]); } if ( StoryProgress.enum_EndingProgress.SLAYER.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.SLAYER; tempDialogue.EndProgressPreReq.Slayer = Convert.ToInt32(DialogueData[1]); } if ( StoryProgress.enum_EndingProgress.SUICIDE.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.SUICIDE; tempDialogue.EndProgressPreReq.Suicide = Convert.ToInt32(DialogueData[1]); } if ( StoryProgress.enum_EndingProgress.TUNNEL.ToString() == DialogueData[0]) { tempDialogue.EndProgressPreReq.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.TUNNEL; tempDialogue.EndProgressPreReq.Tunnel = Convert.ToInt32(DialogueData[1]); } // pre req point tempDialogue.i_PlayerPreReq = Convert.ToInt32(DialogueData[2]); // the actual line tempDialogue.Statement = DialogueData[3]; // now the responses int numResponses = Convert.ToInt32(DialogueData[4]); line= file.ReadLine(); NumberOfLines++; string[] ResponseData = line.Split(','); for (int r = 0; r < numResponses; r++) { // get the individual response's data string[] responses = ResponseData[r].Split(':'); // the string of response tempDialogue.TheResponses.Add(responses[0]); //story prog data if ( StoryProgress.enum_EndingProgress.NONE.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.NONE; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.FOODTRUCK.ToString() ==responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.FOODTRUCK; tempStorydiag.Foodtruck = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.INSANE.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.INSANE; tempStorydiag.Insane = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.CRIPPLE.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.CRIPPLE; tempStorydiag.Cripple = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.SLAYER.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.SLAYER; tempStorydiag.Slayer = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.SUICIDE.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.SUICIDE; tempStorydiag.Suicide = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } if ( StoryProgress.enum_EndingProgress.TUNNEL.ToString() == responses[1]) { StoryProgress tempStorydiag = new StoryProgress(); tempStorydiag.enum_EndingProgressThis = StoryProgress.enum_EndingProgress.TUNNEL; tempStorydiag.Tunnel = 1; tempDialogue.ResponseEndingProg.Add(tempStorydiag); } //player stat tempDialogue.ResponseEndingPlayerStat.Add(Convert.ToInt32(responses[2])); } ReturnedCharacter.Dialogues.Add(tempDialogue); } //string[] Positions = line.Split(','); // get postition from file // close your file! file.Close(); Console.WriteLine("Total number of lines : " + NumberOfLines); return ReturnedCharacter; }