protected override void CreateScene() { Load(WaveContent.Scenes.PlayGameOverPopupScene); _soundManager = WaveServices.GetService <SimpleSoundService>(); Pause(); #if DEBUG AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); #endif }
protected override void ResolveDependencies() { _scene = Scene as PlayRouletteScene; _soundManager = WaveServices.GetService <SimpleSoundService>(); _needleImage = _scene.EntityManager.Find("needleImage"); _needleImageRigidBody2D = _needleImage.FindComponent <RigidBody2D>(); _movementsTextBlockText = _scene.EntityManager.Find("movementsTextBlock").FindComponent <TextComponent>(); _noMovementsTextBlock = _scene.EntityManager.Find("noMovementsTextBlock"); Entity _needlePin = _scene.EntityManager.Find("needlePin"); _revoluteJoint = _needlePin.FindComponent <RevoluteJoint2D>(); }
protected override void CreateScene() { Load(WaveContent.Scenes.MainMenuScene); _gameStorage = Catalog.GetItem <GameStorage>(); _soundManager = WaveServices.GetService <SimpleSoundService>(); if (_gameStorage.IsMusicEnabled) { WaveServices.MusicPlayer.MusicEnabled = true; WaveServices.MusicPlayer.Volume = 0.6f; WaveServices.MusicPlayer.IsMuted = false; } #if DEBUG AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); #endif }
protected override void CreateScene() { Load(WaveContent.Scenes.PlayScene); _gameStorage = Catalog.GetItem <GameStorage>(); _soundManager = WaveServices.GetService <SimpleSoundService>(); WaveServices.MusicPlayer.IsMuted = true; WaveServices.MusicPlayer.MusicEnabled = false; WaveServices.MusicPlayer.Volume = 0; Entity rouletteImage = new Entity("rouletteImage") .AddComponent(new Transform2D { DrawOrder = 1, Origin = new Vector2(0.5f, 0.5f), Scale = new Vector2(0.5f, 0.5f), X = 7 * (VirtualScreenManager.VirtualWidth / 8) - 30, Y = (VirtualScreenManager.VirtualHeight / 4f) + 30 }) .AddComponent(new Sprite(WaveContent.Assets.Textures.Roulette.Roulette_png)) .AddComponent(new SpriteRenderer()); EntityManager.Add(rouletteImage); Entity needleImage = new Entity("needleImage") .AddComponent(new Transform2D { DrawOrder = 0, Origin = new Vector2(0.5f, 0.5f), Scale = new Vector2(0.5f, 0.5f), X = 7 * (VirtualScreenManager.VirtualWidth / 8) - 30, Y = (VirtualScreenManager.VirtualHeight / 4f) + 30 }) .AddComponent(new Sprite(WaveContent.Assets.Textures.Roulette.Needle_png)) .AddComponent(new SpriteRenderer(DefaultLayers.Alpha)) .AddComponent(new CircleCollider2D() { DebugLineColor = Color.Blue, Density = 0.05f }) .AddComponent(new RigidBody2D { PhysicBodyType = RigidBodyType2D.Dynamic, LinearDamping = 1, AngularDamping = 1, GravityScale = 0 }); EntityManager.Add(needleImage); Entity needlePin = new Entity("needlePin") .AddComponent(new Transform2D { DrawOrder = 1, Origin = new Vector2(0.5f, 0.5f), Scale = new Vector2(0.5f, 0.5f), X = 7 * (VirtualScreenManager.VirtualWidth / 8) - 30, Y = (VirtualScreenManager.VirtualHeight / 4f) + 30 }) .AddComponent(new Sprite(WaveContent.Assets.Textures.Pixel_png)) .AddComponent(new SpriteRenderer(DefaultLayers.Opaque)) .AddComponent(new RectangleCollider2D()) .AddComponent(new RigidBody2D() { PhysicBodyType = RigidBodyType2D.Kinematic }) .AddComponent(new RevoluteJoint2D() { EnableMotor = false, MaxMotorTorque = 1000f, ConnectedEntityPath = "needleImage" }) .AddComponent(new MotorBehavior() { IsActive = true }); EntityManager.Add(needlePin); CreateMatCircles(); #region HUD // Automatic Toggle Button OFF _toggleAutomaticOff = new Button { BackgroundImage = WaveContent.Assets.Textures.Buttons.ToggleButtonAutomaticOff_png, PressedBackgroundImage = WaveContent.Assets.Textures.Buttons.ToggleButtonAutomaticOver_png, Margin = new Thickness(150, 10, 0, 0), Height = 50, Text = "", IsVisible = true }; _toggleAutomaticOff.Click += OnToggleAutomaticOffClicked; EntityManager.Add(_toggleAutomaticOff); // Automatic Toggle Button ON _toggleAutomaticOn = new Button { BackgroundImage = WaveContent.Assets.Textures.Buttons.ToggleButtonAutomaticOn_png, PressedBackgroundImage = WaveContent.Assets.Textures.Buttons.ToggleButtonAutomaticOver_png, Margin = new Thickness(150, 10, 0, 0), Height = 50, IsBorder = false, Text = "", IsVisible = false }; _toggleAutomaticOn.Click += OnToggleAutomaticOnClicked; EntityManager.Add(_toggleAutomaticOn); // Automatic Text TextBlock textAutomatic = new TextBlock { FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Margin = new Thickness(20, 25, 0, 0), Foreground = Color.Black, Text = "Automatic:" }; EntityManager.Add(textAutomatic.Entity); // Timer Text TextBlock textTime = new TextBlock { HorizontalAlignment = HorizontalAlignment.Left, FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) - 20, 25, 0, 0), Foreground = Color.Black, Text = "Timer:" }; EntityManager.Add(textTime.Entity); // Decrease Time Button Disabled _buttonTimerDecreaseDisabled = new Image(WaveContent.Assets.Textures.Buttons.ButtonLeftDisabled_png) { HorizontalAlignment = HorizontalAlignment.Left, Width = 50, Height = 50, IsBorder = false, Stretch = Stretch.UniformToFill, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) + 60, 10, 0, 0), IsVisible = true }; EntityManager.Add(_buttonTimerDecreaseDisabled.Entity); // Decrease Time Button _buttonTimerDecrease = new Button { HorizontalAlignment = HorizontalAlignment.Left, PressedBackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonLeftOver_png, BackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonLeft_png, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) + 60, 10, 0, 0), Text = "", Width = 50, Height = 50, IsBorder = false, IsVisible = false }; _buttonTimerDecrease.Click += OnButtonTimerDecreaseClicked; EntityManager.Add(_buttonTimerDecrease.Entity); // Timer Time Text _textTimer = new TextBlock { HorizontalAlignment = HorizontalAlignment.Left, FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) + 115, 25, 0, 0), Foreground = Color.Black, TextAlignment = TextAlignment.Center, Width = 50, Text = WaitTime + " s" }; EntityManager.Add(_textTimer.Entity); // Increase Time Button Disabled _buttonTimerIncreaseDisabled = new Image(WaveContent.Assets.Textures.Buttons.ButtonRightDisabled_png) { HorizontalAlignment = HorizontalAlignment.Left, Width = 50, Height = 50, IsBorder = false, Stretch = Stretch.UniformToFill, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) + 170, 10, 0, 0), IsVisible = true }; EntityManager.Add(_buttonTimerIncreaseDisabled.Entity); // Increase Time Button _buttonTimerIncrease = new Button { HorizontalAlignment = HorizontalAlignment.Left, PressedBackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonRightOver_png, BackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonRight_png, Margin = new Thickness((VirtualScreenManager.VirtualWidth / 4) + 170, 10, 0, 0), Text = "", Width = 50, Height = 50, IsBorder = false, IsVisible = false }; _buttonTimerIncrease.Click += OnButtonTimerIncreaseClicked; EntityManager.Add(_buttonTimerIncrease.Entity); // Time left for next round Text TextBlock textTimeLeftRound = new TextBlock { HorizontalAlignment = HorizontalAlignment.Left, FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Margin = new Thickness(2 * (VirtualScreenManager.VirtualWidth / 4), 25, 0, 0), Foreground = Color.Black, Text = "Time left for the next round:" }; EntityManager.Add(textTimeLeftRound.Entity); TimerLeftTextBlock = new TextBlock("timerLeftTextBlock") { HorizontalAlignment = HorizontalAlignment.Left, TextAlignment = TextAlignment.Right, FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Foreground = Color.Black, Text = "- s", Margin = new Thickness(2 * (VirtualScreenManager.VirtualWidth / 4) + 310, 25, 0, 0) }; EntityManager.Add(TimerLeftTextBlock.Entity); if (NumberOfPlayers == NumberPlayerEnum.OnePlayer) { TextBlock textRecord = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, TextAlignment = TextAlignment.Right, FontPath = WaveContent.Assets.Fonts.HelveticaRounded_16_ttf, Margin = new Thickness(0, 25, 20, 0), Foreground = Color.Black, Text = "Record: " + _gameStorage.Record }; EntityManager.Add(textRecord.Entity); } Grid gridUpMovementList = new Grid { DrawOrder = 0.9f, BackgroundColor = Color.White, Width = 360, Height = 60, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, VirtualScreenManager.TopEdge, 0, 0) }; EntityManager.Add(gridUpMovementList); // Back button for return to Main Menu. _buttonBack = new Button { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(10), Text = "", FontPath = WaveContent.Assets.Fonts.Kabel_Dm_BT_18_TTF, Width = 163, Height = 82, IsBorder = false, BackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonGoBack_png, PressedBackgroundImage = WaveContent.Assets.Textures.Buttons.ButtonGoBackOver_png }; _buttonBack.Click += OnButtonBackClicked; EntityManager.Add(_buttonBack.Entity); #endregion AddSceneBehavior(new PlaySceneBehavior(), SceneBehavior.Order.PostUpdate); #if DEBUG AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); #endif }