/// <summary>
        /// creates a game
        /// </summary>
        /// <param name="width">width of the window</param>
        /// <param name="height">height of the window</param>
        /// <param name="title">titel of the window</param>
        /// <param name="screen">style of the window</param>
        public AbstractGame(uint width, uint height, string title, SFML.Window.Styles screen)
        {
            win = new RenderWindow(new SFML.Window.VideoMode(width, height), title, screen);

            win.Closed += (sender, e) => { ((RenderWindow)sender).Close(); };

            gameTime = new GameTime();
            MouseControler.Initialize(win);
            KeyboardControler.Initialize();
        }
 public static void Update(GameTime t)
 {
     for(int i = 0; i<Projectiles.Count; ++i)
     {
         if (!Projectiles[i].IsAlive)
         {
             Projectiles.RemoveAt(i);
             --i;
         }
         else
             Projectiles[i].Update(t);
     }
 }
        public override void Update(GameTime gameTime)
        {
            Help.Update(gameTime);
            MouseControler.Update();
            KeyboardControler.Update();

            if (currentGameState != prevGameState)
            {
                HandleGameState();
            }

            currentGameState = gameState.Update(gameTime);
        }
 public static void Update(GameTime gTime)
 {
     for (int i = 0; i < Towers.Count; ++i)
     {
         if (!Towers[i].IsAlive)
         {
             Towers.RemoveAt(i);
             --i;
         }
         else
             Towers[i].Update(gTime);
     }
 }
        public void Update(GameTime t)
        {
            if (!Target.IsAlive)
                IsAlive = false;

            TargetPosition = (Target.Position + Target.Size / 2 - new Vec2f(sprite.Texture.Size.X, sprite.Texture.Size.Y) / 2);

            sprite.Position = (Vec2f)sprite.Position + (TargetPosition - (Vec2f)sprite.Position).GetNormalized() * MovementSpeed * t.EllapsedTime.Milliseconds;

            if(TargetPosition.Distance(sprite.Position)<=Help.Epsilon)
            {
                Target.DoDamage(Damage);
                IsAlive = false;
            }
        }
 public abstract void Update(GameTime gameTime);
        public void Update(GameTime gTime)
        {
            if (Activated)
                Shooting(gTime);

            if(Selected)
            {
                sprite.Position = MouseControler.MousePosition - new Vec2f((sprite.Texture.Size.X * sprite.Scale.X)/2, (sprite.Texture.Size.Y * sprite.Scale.Y) / 2);
            }

            if (MouseControler.MouseIn(sprite))
            {
                c.Position = (Vec2f)sprite.Position - Range + new Vec2f((sprite.Texture.Size.X * sprite.Scale.X) / 2, (sprite.Texture.Size.Y * sprite.Scale.Y) / 2);
            }
        }
        protected void Shooting(GameTime gTime)
        {
            float currentDistance;

            foreach (AbstractEnemy enemy in EnemyHandler.Enemies)
            {
                currentDistance = this.Position.Distance(enemy.Position);

                if (!Selected && currentDistance <= Range && timeSpan.CompareTo(gTime.TotalTime) < 0)
                {
                    new Projectile(Position + new Vec2f((sprite.Texture.Size.X * sprite.Scale.X) / 2, (sprite.Texture.Size.Y * sprite.Scale.Y) / 2),
                        enemy, Damage, ProjectiePath);
                    timeSpan = gTime.TotalTime.Add(Cooldown);
                    break;
                }
            }
        }
 public EGameStates Update(GameTime time)
 {
     return EGameStates.GameOver;
 }
 public static void Update(GameTime t)
 {
     Epsilon = baseEpsilon * t.EllapsedTime.Milliseconds;
 }
        public EGameStates Update(GameTime time)
        {
            Console.WriteLine("Existing GameObject Count: " + ExistingGameObjects);

            try
            {
                EnemyHandler.Update(time);
                TowerHandler.Update(time);
                ProjectileHandler.Update(time);

                DisplayTowerStats();

                MoneyTxt.DisplayedString = "Money: " + Money;
            }
            catch (ArgumentOutOfRangeException)
            {
                return EGameStates.GameOver;
            }

            return EGameStates.InGame;
        }
 public EGameStates Update(GameTime time)
 {
     return ReturnState;
 }
        protected void Animate(GameTime t)
        {
            i = (t.TotalTime.Milliseconds / AnimationRate) % AnimationSteps;

            sprite.Texture = TextureList[i + Movement * AnimationSteps];
        }
        public void Update(GameTime gTime)
        {
            if (IsAlive)
            {
                Animate(gTime);

                LifeBar.Scale = new Vec2f(Life / MaxLife, 1);
                LifeBar.Position = (Vec2f)sprite.Position + new Vec2f(0, LifeBar.Texture.Size.Y);

                if (Position.Distance(Verticies[VertexIndex]) < Help.Epsilon)
                    VertexIndex++;
                sprite.Position = Position + (Verticies[VertexIndex] - Position).GetNormalized() * MovementSpeed * gTime.EllapsedTime.Milliseconds;

                float x = (Verticies[VertexIndex] - Position).X;
                float y = (Verticies[VertexIndex] - Position).Y;

                Vec2i v = new Vec2i((Math.Abs(x) >= 1) ? (int)x / (int)Math.Abs(x) : 0, (Math.Abs(y) >= 1) ? (int)y / (int)Math.Abs(y) : 0);

                if (v == new Vec2i(1, 0))
                    Movement = 0;
                if (v == new Vec2i(-1, 0))
                    Movement = 1;
                if (v == new Vec2i(0, -1))
                    Movement = 2;
                if (v == new Vec2i(0, 1))
                    Movement = 3;

                if (Life <= 0)
                {
                    IsAlive = false;
                    InGame.Money += Money;
                }
            }
        }
        public EGameStates Update(GameTime time)
        {
            CheckMouse();

            return ReturnState;
        }