コード例 #1
0
        /// <summary>
        /// Updates all ballistics
        /// To be run in its own thread
        /// </summary>
        public void Update()
        {
            while (true)
            {
                if (Projectiles.Any())
                {
                    foreach (var projectile in Projectiles)
                    {
                        projectile.Update();

                        foreach (var invader in _game._invaders.Enemies)
                        {
                            if (invader.GetHitbox().ContainsCell(projectile.Model))
                            {
                                invader.Dead         = true;
                                projectile.Collision = true;
                            }
                        }
                    }

                    Projectiles.RemoveAll(x => x.Collision);
                }

                Thread.Sleep(100);
            }
        }