protected override void OnUpdate()
    {
        Entities
        .ForEach((PlayerAuthoring playerAuthoring) =>
        {
            var entity = GetPrimaryEntity(playerAuthoring);
            var cameraFollowComponent = new CameraFollowComponent
            {
                CameraFollowOffset = new float3(0, 10, -10),
                CameraSmoothSpeed  = 0.25f
            };

            DstEntityManager.AddComponent(entity, typeof(MovementComponent));
            DstEntityManager.AddComponentData(entity, cameraFollowComponent);
        });
    }
        //The multitude of options here is for easy debug purposes
        public void CreatePlayer(string name, int entityId, ActionBindings actionBindings,
                                 Vector2 position = default(Vector2), bool movable           = true, bool useDefaultMoveComponent = true,
                                 MoveComponent customMoveComponent = null, bool cameraFollow = false, bool collision              = false,
                                 bool disabled = false, bool isCaged = false, int cageId = 0)
        {
            if (disabled)
            {
                return;
            }
            if (position == default(Vector2))
            {
                position = new Vector2(150, 150);
            }


            var renderComponent = new RenderComponent()
            {
                DimensionsComponent = new DimensionsComponent()
                {
                    Height = 100,
                    Width  = 100
                },
            };

            var positionComponent = new PositionComponent()
            {
                Position = position, ZIndex = 10
            };

            var dampeningComponent        = new InertiaDampeningComponent();
            var backwardsPenaltyComponent = new BackwardsPenaltyComponent();

            ComponentManager.Instance.AddComponentToEntity(dampeningComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(backwardsPenaltyComponent, entityId);

            var spriteComponent = new SpriteComponent()
            {
                SpriteName = "topDownSoldier",
                Scale      = 1
            };
            var light = new LightComponent()
            {
                Light = new Spotlight()
                {
                    Position   = new Vector2(150, 150),
                    Scale      = new Vector2(850f),
                    Radius     = (float)0.0001,
                    Intensity  = (float)0.6,
                    ShadowType = ShadowType.Solid // Will not lit hulls themselves
                }
            };

            var sound = new SoundComponent()
            {
                SoundEffectName = "walking"
            };

//            var animation = new SpriteAnimationComponent()
//            {
////                Spritesheet = Content.Load<Texture2D>("blood"),
////                SpritesheetSize = new Point(3, 3),
////                MillisecondsPerFrame = 30,
//                AnimationStarted = 0,
//                CurrentAnimatedState =
//            };
//            ComponentManager.Instance.AddComponentToEntity(animation, entityId);

            var animationBindings = new SpriteAnimationBindingsBuilder()
                                    .Binding(
                new SpriteAnimationBindingBuilder()
                .Positions(new Point(0, 0), new Point(1000, 1000))
                .StateConditions(State.WalkingForward)
                .Length(30)
                .Build()
                )
                                    .Build();

            ComponentManager.Instance.AddComponentToEntity(sound, entityId);
            ComponentManager.Instance.AddComponentToEntity(renderComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(positionComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(spriteComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(actionBindings, entityId);
            ComponentManager.Instance.AddComponentToEntity(light, entityId);
            ComponentManager.Instance.AddComponentToEntity(animationBindings, entityId);

            if (movable && useDefaultMoveComponent)
            {
                var moveComponent = new MoveComponent()
                {
                    MaxVelocitySpeed  = 200,
                    AccelerationSpeed = 380,
                    RotationSpeed     = 4,
                    Direction         = new Random(DateTime.Now.Millisecond).Next(0, 40) / 10
                };
                ComponentManager.Instance.AddComponentToEntity(moveComponent, entityId);
            }
            else if (movable && customMoveComponent != null)
            {
                ComponentManager.Instance.AddComponentToEntity(customMoveComponent, entityId);
            }

            if (collision)
            {
                var collisionComponent = new CollisionComponent()
                {
                    spriteBoundingRectangle = new Rectangle(30, 20, 70, 60)
                };
                ComponentManager.Instance.AddComponentToEntity(collisionComponent, entityId);
            }
            if (cameraFollow)
            {
                var cameraFollowComponent = new CameraFollowComponent();
                ComponentManager.Instance.AddComponentToEntity(cameraFollowComponent, entityId);
            }

            if (isCaged)
            {
                var cageComponent = new CageComponent()
                {
                    CageId = cageId
                };
                ComponentManager.Instance.AddComponentToEntity(cageComponent, entityId);
            }

            var playerComponent = new PlayerComponent()
            {
                Name = name
            };

            ComponentManager.Instance.AddComponentToEntity(playerComponent, entityId);
            var healthComponent = new HealthComponent()
            {
                CurrentHealth = new Random().Next(0, 100)
            };

            ComponentManager.Instance.AddComponentToEntity(healthComponent, entityId);
            var weaponComponent = new WeaponComponent()
            {
                Damage = 10
            };

            ComponentManager.Instance.AddComponentToEntity(weaponComponent, entityId);
        }
        //The multitude of options here is for easy debug purposes
        public void CreatePlayer(int entityId, ActionBindings actionBindings, Vector2 position = default(Vector2), bool movable = true, bool useDefaultMoveComponent = true, MoveComponent customMoveComponent = null, bool cameraFollow = false, bool collision = false, bool disabled = false, bool isCaged = false, int cageId = 0)
        {
            if (disabled)
            {
                return;
            }
            if (position == default(Vector2))
            {
                position = new Vector2(150, 150);
            }
            //Initializing first, movable, entity
            //var renderComponent = new RenderComponentBuilder()
            //    //.Position(150 + new Random(DateTime.Now.Millisecond).Next(0, 500), 150, 10)
            //    .Position(position.X, position.Y, 10)
            //    //.Radius(60)
            //    .Dimensions(100, 100)
            //    .Build();

            var renderComponent3 = new RenderComponent()
            {
                DimensionsComponent = new DimensionsComponent()
                {
                    Height = 100, Width = 100
                }, Radius = 60
            };
            var positionComponent3 = new PositionComponent()
            {
                Position = position, ZIndex = 10
            };

            ComponentManager.Instance.AddComponentToEntity(renderComponent3, entityId);
            ComponentManager.Instance.AddComponentToEntity(positionComponent3, entityId);


            var spriteComponent = new SpriteComponent()
            {
                SpriteName = "topDownSoldier"
            };
            var light = new LightComponent()
            {
                Light = new Spotlight()
                {
                    Position   = new Vector2(150, 150),
                    Scale      = new Vector2(850f),
                    Radius     = (float)0.0001,
                    Intensity  = (float)0.6,
                    ShadowType = ShadowType.Solid // Will not lit hulls themselves
                }
            };

            var sound = new SoundComponent()
            {
                SoundEffectName = "walking"
            };

            ComponentManager.Instance.AddComponentToEntity(sound, entityId);
            // ComponentManager.Instance.AddComponentToEntity(renderComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(spriteComponent, entityId);
            ComponentManager.Instance.AddComponentToEntity(actionBindings, entityId);
            ComponentManager.Instance.AddComponentToEntity(light, entityId);

            if (movable && useDefaultMoveComponent)
            {
                var moveComponent = new MoveComponent()
                {
                    MaxVelocitySpeed  = 200,
                    AccelerationSpeed = 380,
                    RotationSpeed     = 4,
                    Direction         = new Random(DateTime.Now.Millisecond).Next(0, 40) / 10
                };
                ComponentManager.Instance.AddComponentToEntity(moveComponent, entityId);
            }
            else if (movable && customMoveComponent != null)
            {
                ComponentManager.Instance.AddComponentToEntity(customMoveComponent, entityId);
            }

            if (collision)
            {
                var collisionComponent = new CollisionComponent()
                {
                    spriteBoundingRectangle = new Rectangle(30, 20, 70, 60)
                };
                ComponentManager.Instance.AddComponentToEntity(collisionComponent, entityId);
            }
            if (cameraFollow)
            {
                var cameraFollowComponent = new CameraFollowComponent();
                ComponentManager.Instance.AddComponentToEntity(cameraFollowComponent, entityId);
            }

            if (isCaged)
            {
                var cageComponent = new CageComponent()
                {
                    CageId = cageId
                };
                ComponentManager.Instance.AddComponentToEntity(cageComponent, entityId);
            }

            var playerComponent = new PlayerComponent()
            {
                Name = entityId.ToString()
            };

            ComponentManager.Instance.AddComponentToEntity(playerComponent, entityId);
            var healthComponent = new HealthComponent()
            {
                CurrentHealth = new Random().Next(0, 100)
            };

            ComponentManager.Instance.AddComponentToEntity(healthComponent, entityId);
            var weaponComponent = new WeaponComponent()
            {
                Damage = 10
            };

            ComponentManager.Instance.AddComponentToEntity(weaponComponent, entityId);
        }
        public override void initialize()
        {
            base.initialize();
            this.addRenderer(new DefaultRenderer());
            SetupPostProcess();

            //var deferredRenderer = addRenderer(new DeferredLightingRenderer(
            //    0, 1, 10, 20));
            //deferredRenderer.setAmbientColor(new Color(10, 10, 10));

            _enemiesContainer = addEntity(new ContainerEntity
            {
                name = "container-enemies"
            });
            EnemyEntity.Container = _enemiesContainer;
            _bulletContainer      = addEntity(new ContainerEntity
            {
                name = "container-bullet"
            });
            BulletEntity.Container = _bulletContainer;
            _itemsContainer        = addEntity(new ContainerEntity()
            {
                name = "container-items"
            });

            _currentMap     = content.Load <TiledMap>(Content.Tilemaps.map1);
            _mapBoundsGroup = _currentMap.getObjectGroup("MapBounds");
            var startPos = _currentMap.getObjectGroup("Points").objectWithName("StartPos");

            _mapEnemies = _currentMap.getObjectGroup("Enemies");
            _mapItems   = _currentMap.getObjectGroup("Upgrades");
            Texture2D freePlayerTexture = content.Load <Texture2D>(Content.Textures.tempFlightSprite);

            Entity            map      = createEntity("map");
            TiledMapComponent tiledMap = map.addComponent(new TiledMapComponent(_currentMap, "Level"));

            // Vector2 halfMapDimensions = new Vector2(tiledMap.width, tiledMap.height) / 2.0f;
            // map.setPosition(-halfMapDimensions);
            tiledMap.setRenderLayer(10);
            var flyingPlayer = new FreemovePlayerEntity(freePlayerTexture)
            {
                name = "player-flying"
            };

            flyingPlayer.addComponent <PositionBoundsLimitComponent>();
            this.addEntity(flyingPlayer);
            EnemyEntity.Player = flyingPlayer;

            var platformPlayer = new PlatformPlayerEntity(freePlayerTexture)
            {
                name = "player-platform"
            };

            platformPlayer.transform.position = new Vector2(startPos.x, startPos.y);
            this.addEntity(platformPlayer);

            CameraFollowComponent cameraFollow = new CameraFollowComponent(platformPlayer.transform);

            camera.addComponent(cameraFollow);

            PlayerManagerComponent p = addSceneComponent <PlayerManagerComponent>();

            p.PlatformPlayer       = platformPlayer.getComponent <PlatformPlayerComponent>();
            p.FreemovePlayer       = flyingPlayer.getComponent <FreemovePlayerComponent>();
            p.CameraFollow         = cameraFollow;
            p.OnTogglePlatforming += OnPlatformToggle;
            p.TogglePlatforming();
            //var scanLines = content.loadEffect(@"nez\effects\Invert.mgfxo");

            _bulletTextures     = new Texture2D[1];
            _enemyTextures      = new Texture2D[1];
            _upgradeTextures    = new Texture2D[1];
            _bulletTextures[0]  = content.Load <Texture2D>(Content.Textures.Enemies.bullet);
            _enemyTextures[0]   = content.Load <Texture2D>(Content.Textures.Enemies.enemy1);
            _upgradeTextures[0] = content.Load <Texture2D>(Content.Textures.tempFlightSprite);
            //// EnemyEntity e = new EnemyEntity(enemyTexture, bullet);
            //e.getComponent<EnemyComponent>().Player = flyingPlayer;
            //addEntity(e);

            addEntityProcessor(new UpgradeTriggerProcessor(new Matcher().all(typeof(UpgradeComponent))));

            CreateUi();
            Time.timeScale = 0.0f;
            Core.startCoroutine(WaitToStart(0.5f));

            ChangeCameraPos();
        }