private void CreatePlayer() { Entity player = new Entity("Player") .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.VirtualWidth / 2f, Y = WaveServices.ViewportManager.VirtualHeight * 0.75f, Origin = Vector2.Center, DrawOrder = 0, }) .AddComponent(new PerPixelCollider("Content/PlayerCollider.wpk", 0.5f)) .AddComponent(new PlayerBehavior(this.gameplayBehavior)) .AddComponent(new Sprite("Content/Player.wpk")) .AddComponent(new SpriteRenderer(DefaultLayers.Alpha)); EntityManager.Add(player); // Bullet Manager BulletManager bulletManager = new BulletManager(this.gameplayBehavior); EntityManager.Add(bulletManager); this.gameplayBehavior.Player = player; // Left Joystick RectangleF leftArea = new RectangleF(WaveServices.ViewportManager.LeftEdge, WaveServices.ViewportManager.TopEdge, WaveServices.ViewportManager.VirtualWidth / 2f + Math.Abs(WaveServices.ViewportManager.LeftEdge), WaveServices.ViewportManager.VirtualHeight + Math.Abs(WaveServices.ViewportManager.TopEdge)); var leftJoystick = new Joystick("leftJoystick", leftArea); EntityManager.Add(leftJoystick); // Right Joystick RectangleF rightArea = new RectangleF(WaveServices.ViewportManager.VirtualWidth / 2, WaveServices.ViewportManager.TopEdge, WaveServices.ViewportManager.VirtualWidth / 2f + Math.Abs(WaveServices.ViewportManager.LeftEdge), WaveServices.ViewportManager.VirtualHeight + Math.Abs(WaveServices.ViewportManager.TopEdge)); var fireButton = new FireButton("fireButton", rightArea); EntityManager.Add(fireButton); }