Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow) && (transform.position.y < ScreenTopY)) //Did we try to move up and won't go off screen?
        {
            newPosition = new Vector2(-25, transform.position.y + 12);
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow) && (transform.position.y > ScreenBotY))//Did we try to move Down and won't go off screen?
        {
            newPosition = new Vector2(-25, transform.position.y - 12);
        }
        transform.position = Vector2.MoveTowards(transform.position, newPosition, moveSpeed * Time.deltaTime); //Move without snapping to the location immediately.

        if (Input.GetKeyDown(KeyCode.R))
        {
            //Reload Scene
            SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene);
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            //Return to Title
            SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu);
        }
        if (Input.GetKeyDown(KeyCode.Q))
        {
            //Quit Game
            Debug.Log("Game is Exiting..");
            //Kill the Game
            Application.Quit();
        }
    }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         //Player Dies, main menu
         //BalloonController.playSound(SoundManager.SFX.pop);
         SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene);
         Destroy(gameObject);
     }
 }
Пример #3
0
 private void UserInput()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         //Return to Title
         SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu);
     }
     if (Input.GetKeyDown(KeyCode.Q))
     {
         //Quit Game
         Debug.Log("Game is Exiting..");
         //Kill the Game
         Application.Quit();
     }
     if (Input.GetKeyDown(KeyCode.RightShift))
     {
         //Right Shift, skip to balloon debugger.
         SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene);
     }
 }
Пример #4
0
 private void UserInput()
 {
     //Leave 180 turn option as kill.
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         snekDirection = Direction.Up;
     }
     if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         snekDirection = Direction.Down;
     }
     if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         snekDirection = Direction.Right;
     }
     if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         snekDirection = Direction.Left;
     }
     /////////////////////////////////////////
     ///Menu Buttons//////////////////////////
     /////////////////////////////////////////
     if (Input.GetKeyDown(KeyCode.R))
     {
         //Reload Scene
         SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene);
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         //Return to Title
         SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu);
     }
     if (Input.GetKeyDown(KeyCode.Q))
     {
         //Quit Game
         Debug.Log("Game is Exiting..");
         //Kill the Game
         Application.Quit();
     }
 }
Пример #5
0
 public static void gds()
 {
     SnakeLoader.loadSnake(SnakeLoader.Scenes.BalloonScene);
 }
Пример #6
0
 public void title()
 {
     Debug.Log("Going back to title scene.");
     //To Main Menu
     SnakeLoader.loadSnake(SnakeLoader.Scenes.MainMenu);
 }
Пример #7
0
 public void retry()
 {
     Debug.Log("Scene being Reloaded!");
     //Reload Scene
     SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene);
 }
Пример #8
0
 public void startSnake()
 {
     Debug.Log("Game is being Started!");
     //Reload Scene
     SnakeLoader.loadSnake(SnakeLoader.Scenes.SnakeGameScene);
 }