Game-Design / Sprint3_actual / Everything_NPC / OldWomanPhases / DamagePhase.cs
DamagePhase.cs
Raw
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 DamagePhase : 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 = 4000;
        private IBorder textBox;
        public DamagePhase(room room, Game1 game, int roomXMod, int roomYMod, INPC OldWoman)
        {
            this.room = room;
            this.game = game;
            this.OldWoman = OldWoman;
            this.roomXMod = roomXMod;
            this.roomYMod = roomYMod;
            this.textBox = BorderElementsFactory.Instance.CreateTextBox(96 + roomXMod, 432 + roomYMod);
            this.currentTime = 0;
            room.Addons[0] = textBox;


            room.TextList.Add(TextFactory.Instance.CreateText(17, 210 + roomXMod, 468 + roomYMod));

            room.NPCList.Add(NPCFactory.Instance.CreateNPC(18, 144 + roomXMod, 144 + roomYMod, room, game));
            room.NPCList.Add(NPCFactory.Instance.CreateNPC(18, 576 + roomXMod, 144 + roomYMod, room, game));
            room.NPCList.Add(NPCFactory.Instance.CreateNPC(18, 144 + roomXMod, 336 + roomYMod, room, game));
            room.NPCList.Add(NPCFactory.Instance.CreateNPC(18, 576 + roomXMod, 336 + roomYMod, room, game));
        }

        public void Update(GameTime gameTime)
        {
            this.currentTime += GlobalVars.gameTime.ElapsedGameTime.Milliseconds;


            if (room.NPCList.Count == 1)
            {
                finished = true;
                room.Addons[0] = null;
                OldWoman.takeDamage(0);

            }

        }

        public bool IsFinished()
        {
            return finished;
        }
    }
}