/// <summary> /// Starts the scene elements /// </summary> /// <param name="game">Game manager</param> public void Start(Game game) { // Sets the game frame rate to 60 game.DesiredFrameRate = 60; // Changes the title of the game Console.Title = "Tamagottagettemall"; // Loads the ASCII art from a file _TitleArt = Utils.StringReadFile("Title.txt"); // Sets the current step of the scene to 0 _Step = 0; // This first animation handles the ASCII title animation that goes from right to left // This animation will represent the X-coordinate of the art position // It goes from 32 (right limit) and goes all the way to -360 (the text is 360 characters wide, so -360 would be the left limit) // The animation will take 8000 milliseconds and it will start slow, go through fast and arrives slow _Animation = new SimpleAnimation(32, -360, 8000, Smoothness.StartArrival, () => { // When it's done, goes to the next step of the scene ++_Step; // Another animation happens now // This animation represents the fade in of the small title from the title screen // It goes from 0 (totally transparent) to 1 (totally opaque) // It takes 500 milliseconds and starts fast, goes through fast and arrives slow _Animation.Reset(0.0f, 1.0f, 500, Smoothness.Arrival, () => { // When it's done, goes to the next step of the scene ++_Step; // We will set up the "PRESS START" animation now // As it's gonna flash, we have to make a show animation and a hide animation Action hideAction = null; Action showAction = null; // The show animation will make the "PRESS START" visible for 500 milliseconds // This animation goes from 1 to 1 because the text is meant to be totally opaque this whole time // No need for smoothness, because the values are not varying showAction = () => { // And when the animation is done, calls the hide animation _Animation.Reset(1.0f, 1.0f, 500, Smoothness.None, hideAction); }; // The hide animation will make the "PRESS START" invisible for 1000 milliseconds // This animation goes from 0 to 0 because the text is meant to be totally transparent this whole time // No need for smoothness, because the values are not varying hideAction = () => { // And when the animation is done, calls the show animation // You may notice by now that the animation calls another after it's done - that's how it loops _Animation.Reset(0.0f, 0.0f, 1000, Smoothness.None, showAction); }; // First it starts with the show animation showAction(); }); }); }
/// <summary> /// Starts the scene elements /// </summary> /// <param name="game">Game manager</param> public void Start(Game game) { // Loads the pet art from a file _PetArt = Utils.StringReadFile("Pet.txt"); // Sets the selected action to the first one _ActionSelected = 0; // This first animation is the "Day #" fadein // It goes from 0 (totally transparent) and goes to 1 (totally opaque) // It takes 500 milliseconds to complete the animation and starts fast, goes through fast and arrives slow _Animation = new SimpleAnimation(0.0f, 1.0f, 500, Smoothness.Arrival, () => { // When its done, it waits for 1000 milliseconds _Animation.Reset(1.0f, 1.0f, 1000, Smoothness.None, () => { // Then it fades out in 500 milliseconds _Animation.Reset(1.0f, 0.0f, 500, Smoothness.Start, () => { // When it's done it goes to the next step ++_Step; }); }); }); // Sets the amount of actions left to 2 _ActionsLeft = 2; }