SunsetHigh.Room.update C# (CSharp) Method

update() public method

public update ( float elapsed ) : void
elapsed float
return void
        public virtual void update(float elapsed)
        {
            foreach (Sprite a in Sprites)
            {
                a.update(elapsed);
            }
            //cleanup of projectiles offscreen, somewhat naive removal
            foreach (IInteractable i in new List<IInteractable>(this.Interactables))
            {
                if (i is Projectile)
                {
                    Projectile p = (Projectile)i;
                    if (p.getY() >  this.background.Height * this.background.TileHeight + OFFSCREEN_OFFSET ||
                        p.getY() < 0 - OFFSCREEN_OFFSET ||
                        p.getX() > this.background.Width * this.background.TileWidth + OFFSCREEN_OFFSET ||
                        p.getX() < 0 - OFFSCREEN_OFFSET)
                    {
                        this.removeObject(p);
                    }
                }
            }
            drainSinks();
        }