using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Sprint3_actual.BorderElements; using Sprint3_actual.Text; using Sprint3_actual.SoundManagement; using Sprint3_actual.Items; namespace Sprint3_actual.Everything_NPC.OldWomanPhases { public class EndPhase : IPhase { private room room; private Game1 game; private INPC OldWoman; private int roomXMod; private int roomYMod; private bool finished; private int currentTime; private const int maxTime = 18500; private readonly int[] eventTimes = new int[6] { 4000, 5500, 9500, 12000, 13500, 17500}; private bool[] eventsOccured; private IBorder textBox; public EndPhase(room room, Game1 game, int roomXMod, int roomYMod, INPC oldWoman) { this.room = room; this.game = game; this.roomXMod = roomXMod; this.roomYMod = roomYMod; this.OldWoman = oldWoman; this.textBox = BorderElementsFactory.Instance.CreateTextBox(96 + roomXMod, 432 + roomYMod); this.currentTime = 0; room.Addons[0] = textBox; eventsOccured = new bool[] { false, false, false, false, false, false }; room.TextList.Add(TextFactory.Instance.CreateText(11, 215 + roomXMod, 450 + roomYMod)); SoundEngine.Instance.stopMusic(); } public void Update(GameTime gameTime) { this.currentTime += GlobalVars.gameTime.ElapsedGameTime.Milliseconds; if (currentTime > maxTime) { finished = true; room.Addons[0] = null; room.Addons[1] = null; SoundEngine.Instance.playVineBoom(); this.OldWoman.SetPosition(0, 0); room.DoorList[1].Open = true; SoundEngine.Instance.startDungeonMusic(); room.StageItemList.Add(StageItemFactory.Instance.CreateStageItem(30, 96 + roomXMod + 264, 96 + roomYMod + 144, game)); } if(!eventsOccured[0] && currentTime > eventTimes[0]) // TEXT: OH WELL { room.TextList.Add(TextFactory.Instance.CreateText(12, 240 + roomXMod, 468 + roomYMod)); eventsOccured[0] = true; } if (!eventsOccured[1] && currentTime > eventTimes[1]) // TEXT: SLEEP { room.TextList.Add(TextFactory.Instance.CreateText(13, 215 + roomXMod, 450 + roomYMod)); eventsOccured[1] = true; } if (!eventsOccured[2] && currentTime > eventTimes[2]) // TEXT: ENJOY { room.TextList.Add(TextFactory.Instance.CreateText(14, 215 + roomXMod, 468 + roomYMod)); eventsOccured[2] = true; } if (!eventsOccured[3] && currentTime > eventTimes[3]) // TEXT: HERO { room.TextList.Add(TextFactory.Instance.CreateText(15, 230 + roomXMod, 468 + roomYMod)); eventsOccured[3] = true; } if (!eventsOccured[4] && currentTime > eventTimes[4]) // TEXT: CLOSER { room.TextList.Add(TextFactory.Instance.CreateText(16, 235 + roomXMod, 450 + roomYMod)); eventsOccured[4] = true; } if (!eventsOccured[5] && currentTime > eventTimes[5]) // LAUGH { SoundEngine.Instance.playWitchLaugh(); eventsOccured[5] = true; } } public bool IsFinished() { return finished; } } }