public SBGameScene(bool addToFutileOnInit) : base("") { if (addToFutileOnInit) Futile.AddStage(this); finishedDrinks = new List<SBDrink>(); backgroundLayer = new SBBackgroundLayer(); AddChild(backgroundLayer); bar = new SBBar(); AddChild(bar); drinkers = new List<SBEntity>(); specialBarStools = new List<SBBarStool>(); specialBarStool1 = new SBBarStool("special bar stool 1", new Color(0.3f, 0.5f, 1.0f, 1.0f)); specialBarStool1.x = 100f; specialBarStool1.y = Futile.screen.height - SBConfig.TOP_UI_HEIGHT - 100f; specialBarStool1.tag = 1; specialBarStool1.ProgressBarComponent().progressBar.isVisible = false; specialBarStool1.SittableComponent().isSpecial = true; specialBarStools.Add(specialBarStool1); AddChild(specialBarStool1); specialBarStool2 = new SBBarStool("special bar stool 2", new Color(1.0f, 0.3f, 0.5f, 1.0f)); specialBarStool2.x = Futile.screen.width - 100f; specialBarStool2.y = Futile.screen.height - SBConfig.TOP_UI_HEIGHT - 100f; specialBarStool2.tag = 2; specialBarStool2.ProgressBarComponent().progressBar.isVisible = false; specialBarStool2.SittableComponent().isSpecial = true; specialBarStools.Add(specialBarStool2); AddChild(specialBarStool2); drinker1 = new SBDrinker("player 1"); drinker1.tag = 1; drinker1.SpriteComponent(1).sprite.color = new Color(0.3f, 0.5f, 1.0f, 1.0f); drinker1.x = Futile.screen.halfWidth - 200f; drinker1.y = (Futile.screen.height - SBConfig.TOP_UI_HEIGHT) / 2f; drinker1.ProgressBarComponent().progressBar.isVisible = false; drinker1.ProgressBarComponent().progressBar.y += 45f; drinker1.DirectionComponent().FaceDirection(Direction.Left, true); //drinker1.SpriteComponent().sprite.color = new Color(0.3f, 0.5f, 1.0f, 1.0f); drinkers.Add(drinker1); AddChild(drinker1); drinker2 = new SBDrinker("player 2"); drinker2.tag = 2; drinker2.SpriteComponent(1).sprite.color = new Color(1.0f, 0.3f, 0.5f, 1.0f); drinker2.x = Futile.screen.halfWidth + 200f; drinker2.y = (Futile.screen.height - SBConfig.TOP_UI_HEIGHT) / 2f; drinker2.ProgressBarComponent().progressBar.isVisible = false; drinker2.ProgressBarComponent().progressBar.y += 45f; drinker2.DirectionComponent().FaceDirection(Direction.Right, true); //drinker2.SpriteComponent().sprite.color = new Color(1.0f, 0.3f, 0.5f, 1.0f); drinkers.Add(drinker2); AddChild(drinker2); hudLayer = new SBHudLayer(); drinker1.SignalFinishedDrink += hudLayer.HandleDrinkerFinishedDrink; drinker2.SignalFinishedDrink += hudLayer.HandleDrinkerFinishedDrink; drinker1.SignalFinishedDrink += HandleDrinkerFinishedDrink; drinker2.SignalFinishedDrink += HandleDrinkerFinishedDrink; drinker1.SignalBladderChanged += hudLayer.HandleBladderChanged; drinker2.SignalBladderChanged += hudLayer.HandleBladderChanged; drinker1.SignalPissedHimself += HandleDrinkerPissedHimself; drinker2.SignalPissedHimself += HandleDrinkerPissedHimself; AddChild(hudLayer); countdownLabel = new FLabel("Silkscreen", "3"); countdownLabel.color = Color.red; countdownLabel.x = Futile.screen.halfWidth; countdownLabel.y = (Futile.screen.height - SBConfig.TOP_UI_HEIGHT) / 2f; AddChild(countdownLabel); borderLayer = new SBBorderLayer(); AddChild(borderLayer); playAgain = new FLabel("Silkscreen", "play again"); playAgain.scale = 0.5f; playAgain.x = Futile.screen.halfWidth - 200f; playAgain.y = -175f; playAgain.color = Color.black; AddChild(playAgain); mainMenu = new FLabel("Silkscreen", "main menu"); mainMenu.scale = 0.5f; mainMenu.x = Futile.screen.halfWidth + 200f; mainMenu.y = -175f; mainMenu.color = Color.black; AddChild(mainMenu); #if ARCADE_VERSION playAgainButtons = new SBArcadeButtons(true); playAgainButtons.currentFlashingButton = 2; playAgainButtons.scale = 0.3f; playAgainButtons.x = playAgain.x - 90f; playAgainButtons.y = playAgain.y - 140f; AddChild(playAgainButtons); mainMenuButtons = new SBArcadeButtons(true); mainMenuButtons.currentFlashingButton = 5; mainMenuButtons.scale = 0.3f; mainMenuButtons.x = mainMenu.x - 90f; mainMenuButtons.y = mainMenu.y - 140f; AddChild(mainMenuButtons); #else playAgainLabel = new SBKeyCodeLabel("SPACE", Color.black, new Color(0.7f, 0, 0, 1.0f)); playAgainLabel.scale = 0.5f; playAgainLabel.x = playAgain.x - 75f; playAgainLabel.y = playAgain.y - 100f; AddChild(playAgainLabel); mainMenuLabel = new SBKeyCodeLabel("Q", Color.black, new Color(0.7f, 0, 0, 1.0f)); mainMenuLabel.scale = 0.5f; mainMenuLabel.x = mainMenu.x - 10f; mainMenuLabel.y = mainMenu.y - 100f; AddChild(mainMenuLabel); #endif /*tempLogLabel = new FLabel("Silkscreen", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); tempLogLabel.color = Color.black; tempLogLabel.x = 400f; tempLogLabel.y = Futile.screen.halfHeight; tempLogLabel.scale = 0.35f; AddChild(tempLogLabel);*/ }
public void HandleDrinkerFinishedDrink(SBDrinker drinker) { if (drinker.drinkCount >= SBConfig.DRINKS_TO_WIN) { drinker.SpriteComponent(1).StartAnimation(WTMain.animationManager.AnimationForName("drinkerPassOut")); isGameOver = true; FLabel label = new FLabel("Silkscreen", string.Format(drinker.name + " wins!")); label.color = Color.black; label.x = Futile.screen.halfWidth; label.y = Futile.screen.height * 1.25f; Go.to(label, 0.5f, new TweenConfig().floatProp("y", Futile.screen.height * 0.75f)); AddChild(label); PopupEndGameLabels(); FSoundManager.StopMusic(); FSoundManager.PlaySound("winSong"); } }
public SBDrinker NewPrefabbedDrinker(Direction faceDirection, Color color, int tag) { SBDrinker drinker = new SBDrinker("drinker"); drinker.tag = tag; drinker.DirectionComponent().FaceDirection(faceDirection); drinker.ProgressBarComponent().progressBar.isVisible = false; drinker.SpriteComponent(1).sprite.color = color; return drinker; }