void Start() { // THIS MAY NEED TO COME OUT AND BE REPLACED WITH A PROPER EXIT BUTTON //Screen.fullScreen = false; #if !(UNITY_IOS || UNITY_ANDROID) socialOpts.SetActive(false); exitBtn.SetActive(false); #endif persistorObj = GameObject.Find("Persistor"); audioCtrl = persistorObj.GetComponent <AudioController>(); adCtrl = persistorObj.GetComponent <AdController>(); socCtrl = persistorObj.GetComponent <SocialController>(); adLaunched = false; blinker = GetComponent <BlinkerController>(); audioS = GetComponent <AudioSource> (); AudioListener.volume = audioCtrl.CurrVolume; volSlider.value = audioCtrl.CurrVolume; uiButtons = GetComponentsInChildren <Button>(); Reset(); state = TitleScreenState.none; angle = 0.0f; }
public GameWorld() { random = new Random(); gameState = GameState.GameOverScreen; // Load in the Fonts font = TetrisGame.ContentManager.Load <SpriteFont>("Fonts/8-BitFontSmall"); fontBig = TetrisGame.ContentManager.Load <SpriteFont>("fonts/8-BitFontBig"); // Load in the Sounds selectSound = TetrisGame.ContentManager.Load <SoundEffect>("Sounds/Select"); gameOverSound = TetrisGame.ContentManager.Load <SoundEffect>("Sounds/GameOver"); nextBlock = new NextBlock(); grid = new TetrisGrid(); block = new Block(); score = new Score(); hold = new Hold(); //States title = new TitleScreenState(); over = new GameOverState(); help = new HelpState(); over.grid = grid; over.score = score; block.Grid = grid; grid.Gblock = block; score.grid = grid; score.font = font; hold.font = font; title.fontBig = fontBig; over.fontBig = fontBig; help.fontBig = fontBig; }
public GameMain() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Window.AllowUserResizing = false; graphics.IsFullScreen = true; Resolution.Init(ref graphics); Resolution.SetVirtualResolution(VIRTUAL_WIDTH, VIRTUAL_HEIGHT); Resolution.SetResolution(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height, true); gameStateManager = new GameStateManager(this); Components.Add(gameStateManager); TitleScreenState = new TitleScreenState(this); PlayState = new PlayState(this); ScoreState = new ScoreState(this); CountdownState = new CountdownState(this); gameStateManager.ChangeState((TitleScreenState)TitleScreenState); Components.Add(new InputHandler(this)); Window.ClientSizeChanged += new EventHandler <EventArgs>(Resize); }
public void Run() { if (titleScreenTexture2D == null) { titleScreenTexture2D = content.Load <Texture2D>("Images/title.png"); titleHeader1 = content.Load <Texture2D>("Images/TitleHeader1.png"); titleHeader2 = content.Load <Texture2D>("Images/TitleHeader2.png"); } titleDone = false; titleState = TitleScreenState.NoState; throw new NotImplementedException(); //using (input = new SimpleInputHandler()) //{ // Input.Handlers.Add(input); // input.KeyDown += Keyboard_KeyDown; // while (AgateApp.IsAlive && !titleDone) // { // UpdateTitleScreen(); // DisplayTitleScreen(); // if (State.ThePlayer != null) // { // player = State.ThePlayer; // break; // } // AgateApp.KeepAlive(); // } // renderer.ReplacementDrawMethod = null; //} }
private void SetNewGameText() { titleState = TitleScreenState.NewGameText; titleMenu = 0; ClearTitleText(); bgColor = XleColor.DarkGray; wnd[0] = " Start a new game"; for (int i = 0; i < 25; i++) { wnd[i] = " "; } for (int i = 0; i < 40; i++) { color[24][i] = XleColor.Yellow; } { int i = 4; WriteSlowToString(ref wnd[i++], " You are only a poor peasant on the"); WriteSlowToString(ref wnd[i++], " world of Tarmalon, so it's hardly"); WriteSlowToString(ref wnd[i++], " surprising that you've never seen"); WriteSlowToString(ref wnd[i++], " a dead man before. His crumpled"); WriteSlowToString(ref wnd[i++], " figure lies forlornly by the side"); WriteSlowToString(ref wnd[i++], " of the road."); WriteSlowToString(ref wnd[i++], " "); i++; WriteSlowToString(ref wnd[i++], " Fighting your fear, you kneel by"); WriteSlowToString(ref wnd[i++], " the still-warm corpse. You see a"); WriteSlowToString(ref wnd[i++], " a look of panic on his face, a gold"); WriteSlowToString(ref wnd[i++], " band around his wrist, and a large"); WriteSlowToString(ref wnd[i++], " leather scroll, clutched tightly to"); WriteSlowToString(ref wnd[i++], " his chest."); } wnd[24] = " (Press key/button to continue)"; throw new NotImplementedException(); //input.Keys.ReleaseAll(); //while (input.Keys.Any == false) //{ // Wait(50); //} ClearTitleText(); wnd[0] = " Start a new game"; for (int i = 0; i < 25; i++) { wnd[i] = " "; } for (int i = 0; i < 40; i++) { color[24][i] = XleColor.Yellow; } { int i = 4; WriteSlowToString(ref wnd[i++], " You've never been a thief, yet"); WriteSlowToString(ref wnd[i++], " something compels you to reach for"); WriteSlowToString(ref wnd[i++], " the leather scroll. Getting the"); WriteSlowToString(ref wnd[i++], " armband off is trickier, but you"); WriteSlowToString(ref wnd[i++], " manage to snap it around your own"); WriteSlowToString(ref wnd[i++], " wrist. You scoop up two green coins"); WriteSlowToString(ref wnd[i++], " lying nearby and hasten on your way."); WriteSlowToString(ref wnd[i++], " "); i++; WriteSlowToString(ref wnd[i++], " Before you've gone more than a few"); WriteSlowToString(ref wnd[i++], " steps, your senses waver and shift."); WriteSlowToString(ref wnd[i++], " Rising from the mists, as though "); WriteSlowToString(ref wnd[i++], " you've never been this way before, "); WriteSlowToString(ref wnd[i++], " is a magnificient structure of "); WriteSlowToString(ref wnd[i++], " polished stone. A shimmering arch-"); WriteSlowToString(ref wnd[i++], " way beckons."); } wnd[24] = " (Press key/button to continue)"; throw new NotImplementedException(); //input.Keys.ReleaseAll(); //while (input.Keys.Any == false) //{ // Wait(50); //} titleDone = true; }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { OnExitBtn(); } angle += 3.0f; if (angle >= 360.0f) { angle = 0.0f; } spiralImgTrans.rotation = Quaternion.Euler(0.0f, 0.0f, angle); switch (state) { case TitleScreenState.none: blinker.Open(); state = TitleScreenState.transitioningIn; break; case TitleScreenState.transitioningIn: if (blinker.CheckOpen()) { foreach (Button button in uiButtons) { button.interactable = true; } audioS.clip = music; audioS.loop = true; audioS.Play(); state = TitleScreenState.inMain; } break; case TitleScreenState.inMain: achTimer -= Time.deltaTime; break; case TitleScreenState.startingGame: if (!blinker.CheckOpen()) { if (adLaunched == false) { adCtrl.CountReset(); adLaunched = true; } if (!adCtrl.CheckAdShowing()) { adLaunched = false; state = TitleScreenState.none; blinker.EndSceneTrigger(); SceneManager.LoadScene(2); } } break; case TitleScreenState.inOptions: achTimer -= Time.deltaTime; break; case TitleScreenState.inExtras: achTimer -= Time.deltaTime; break; } if (achTimer <= 0.0f && achReached == false) { achReached = true; UpdateAchievement(Constants.ACH_SOOTHING_SONG, "Achievement: Soothing Song"); } }
public void OnExtrasBtn() { state = TitleScreenState.inExtras; }
public void OnOptionsBtn() { state = TitleScreenState.inOptions; }
public void OnPlayBtn() { Reset(); blinker.Close(); state = TitleScreenState.startingGame; }