Пример #1
0
    public void PlayerDamage()
    {
        SwitchScreen s = this.GetComponent <SwitchScreen>();

        lives -= 1;
        if (lives <= 0)             //should never be less than 0 but just in case
        {
            s.loadScreen("level1"); //go reset game
        }
        else
        {
            PlayerPrefs.SetInt("lives", lives);
            s.switchScreen("level1");
        }
    }
Пример #2
0
        /* The PokemonEngine() constructor initializes all of the important parts of the engine, including managers and screens. */
        public PokemonEngine()
        {
            /* The GraphicsDeviceManager is initialized, and the PreferredBackBuffer properties are set to the constants screenWidth and screenHeight.
             * This means that the engine window will have these dimensions, if possible.
             * The ScreenRectangle is also initialized with a position of zero and the screen width and height. */
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            ScreenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            /* The two vital components of the engine, the InputHandler and the GameStateManager, are initialized and added to the engine's master component list.
             * Whenever base.Update() and base.Draw() are called from this class, everything on the component list is updated and drawn.
             * Since these classes contain all code for handling input and for drawing the game states, everything will now be updated and drawn properly. */
            Components.Add(new InputHandler(this));
            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            /* Every screen is initialized. Each has a reference to the engine and the state manager passed in. */
            SplashScreen          = new SplashScreen(this, stateManager);
            StartScreen           = new StartScreen(this, stateManager);
            WorldScreen           = new WorldScreen(this, stateManager);
            CharacterSelectScreen = new CharacterSelectScreen(this, stateManager);
            LoadGameScreen        = new LoadGameScreen(this, stateManager);
            StarterSelectScreen   = new StarterSelectScreen(this, stateManager);
            InventoryScreen       = new InventoryScreen(this, stateManager);
            BattleScreen          = new BattleScreen(this, stateManager);
            SwitchScreen          = new SwitchScreen(this, stateManager);

            /* The state stack is reset and the SplashScreen is pushed on. This means the first thing to appear when the engine is run will be the SplashScreen. */
            stateManager.ChangeState(SplashScreen);

            /* The content root directory is set to the "/Content/" folder, meaning every filename string passed to Content.Load<T>() will start in this folder. */
            Content.RootDirectory = "Content";

            /* Type matchups are initialized in the PkmnUtils class, which creates the type advantage lookup table. */
            PkmnUtils.InitTypeMatchups();

            /* These two settings make the game run as many times per second as it can.
            * They could be changed later depending on how well the engine performs. */
            IsFixedTimeStep = false;
            graphics.SynchronizeWithVerticalRetrace = false;
        }
Пример #3
0
 public void Start()
 {
     ss = GameObject.Find("DataCenter").GetComponent<SwitchScreen>();
 }
Пример #4
0
        //Set switch screen
        public static string SetSwitchTime()
        {
            string cmd = header + SwitchScreen.SetSwitchTime() + end;

            return(cmd);
        }
Пример #5
0
 public static void NavigateToSwitchScreen(object parameter)
 {
     SwitchScreen?.Invoke(parameter);
 }