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; namespace Sprint3_actual.Everything_NPC.OldWomanPhases { public class CooldownPhase : IPhase { private room room; private Game1 game; private int roomXMod; private int roomYMod; private bool finished; private int currentTime; private const int maxTime = 8000; private const int textTime2 = 4000; private bool text2Printed; private IBorder textBox; private Random rand; private int chatOption; public CooldownPhase(room room, Game1 game, int roomXMod, int roomYMod) { this.room = room; this.game = game; this.roomXMod = roomXMod; this.roomYMod = roomYMod; this.text2Printed = false; this.textBox = BorderElementsFactory.Instance.CreateTextBox(96 + roomXMod, 432 + roomYMod); this.currentTime = 0; room.Addons[0] = textBox; this.rand = new Random(); this.chatOption = rand.Next(0, 2); if (chatOption == 0) { room.TextList.Add(TextFactory.Instance.CreateText(6, 230 + roomXMod, 468 + roomYMod)); } else { room.TextList.Add(TextFactory.Instance.CreateText(7, 220 + roomXMod, 468 + roomYMod)); } } public void Update(GameTime gameTime) { this.currentTime += GlobalVars.gameTime.ElapsedGameTime.Milliseconds; if (currentTime > maxTime) { finished = true; room.Addons[0] = null; } if (!text2Printed && currentTime > textTime2) { this.chatOption = rand.Next(0, 2); if (chatOption == 0) { room.TextList.Add(TextFactory.Instance.CreateText(8, 215 + roomXMod, 450 + roomYMod)); } else { room.TextList.Add(TextFactory.Instance.CreateText(9, 215 + roomXMod, 450 + roomYMod)); } text2Printed = true; } } public bool IsFinished() { return finished; } } }