Esempio n. 1
0
    public void ChangeStategames(GameSate newState)
    {
        //Do things for exiting states
        switch (m_currentState)
        {
        case GameSate.GameOver:
            break;

        case GameSate.Paused:
            m_pauseMenu.SetActive(false);
            break;

        case GameSate.Gameplay:
            break;
        }

        m_currentState = newState;

        //Do things for entering states
        switch (m_currentState)
        {
        case GameSate.GameOver:
            m_gameplayUI.SetActive(false);
            break;

        case GameSate.Paused:
            m_pauseMenu.SetActive(true);
            break;

        case GameSate.Gameplay:
            m_gameplayUI.SetActive(true);
            break;
        }
    }
 private void UnpauseGame()
 {
     if (state == GameSate.Paused)
     {
         state = GameSate.Playing;
         Time.timeScale = 1;
     }
 }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (gameState == GameSate.Idle && Input.GetMouseButtonDown(0))
     {
         Debug.Log("ta bien");
         gameState = GameSate.Playing;
         SceneManager.LoadScene("Instructions", LoadSceneMode.Single);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (gameState == GameSate.Idle && (Input.GetKey(KeyCode.Space)))
     {
         Debug.Log("ta bien");
         gameState = GameSate.Playing;
         SceneManager.LoadScene("SampleScene", LoadSceneMode.Single);
     }
 }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (gameState == GameSate.Idle && (Input.GetKey(KeyCode.Escape)))
     {
         Debug.Log("ta bien");
         gameState = GameSate.Playing;
         SceneManager.LoadScene("MenuInitial", LoadSceneMode.Single);
     }
 }
        private void MainMenu()
        {
            currentGameState = GameSate.MainMenu;

            do
            {
                Console.Clear();
                Console.WriteLine("Welcome to Durak game!\n");

                Console.WriteLine("1. Start new game (start)");
                Console.WriteLine("2. Save game (save)");
                Console.WriteLine("3. Load game (load)");
                Console.WriteLine("4. Options (options)");
                Console.WriteLine("5. Quit (quit)");

                Console.WriteLine("Choose variant: ");

                userInput = Console.ReadLine().ToLower();

                switch (userInput)
                {
                    case "start":
                        isGameStarted = true;
                        Console.WriteLine("Starting game");
                        PlayGame();
                        break;
                    case "save":
                        Console.WriteLine("Not implemented!");
                        break;
                    case "load":
                        Console.WriteLine("Not implemented!");
                        break;
                    case "options":
                        Console.WriteLine("Not implemented!");
                        break;
                    case "quit":
                        isGameQuit = true;
                        Console.WriteLine("Quit!");
                        QuitGame();
                        break;
                    default:
                        Console.WriteLine("Incorrect choice!");
                        break;
                }

                Console.ReadKey(false);

                if (isGameStarted || isGameQuit)
                {
                    isOutOfMainMenu = true;
                }
            }
            while (!isOutOfMainMenu);

            Console.WriteLine("Out of Main Menu!");
        }
    public void SpawnPlayer() {

        PlayerController player = FindObjectOfType<PlayerController>();
        player.transform.position = StartSpawnPoint.transform.position;

        plMotor.Stop();

        state = GameSate.Playing;

    }
    private void PauseGame()
    {

        if (state == GameSate.Paused) return;

        if (canBePaused)
        {
            state = GameSate.Paused;
            Time.timeScale = 0.1f;
        }
        
    }
    // Start is called before the first frame update
    void Start()
    {
        GAME_STATE = GameObject.Find("GameState").GetComponent <GameSate>();

        networkController = GameObject.Find("SocketIO").GetComponent <Network>();
        networkController.onPlayerInput += OnPlayerInput;

        networkController.GameReady();

        PlayersGameObjects = new Dictionary <string, GameObject>();
        InstantiatePlayer();
    }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        GAME_STATE = GameObject.Find("GameState").GetComponent <GameSate>();


        networkController = GameObject.Find("SocketIO").GetComponent <Network>();
        networkController.CreateRoom();

        networkController.onRoomCreated += SetRoomCode;

        networkController.onPlayerEnter += OnPlayerEnter;
        networkController.onPlayerReady += OnPlayerReady;
    }
 private void GameOver()
 {
     currentGameState = GameSate.GameOver;
 }
Esempio n. 12
0
    public void CheckWinConditions() {

        bool AllConditionsFulfiled = false;
        if (state == GameSate.Paused) return;        

        // Here will be added new win conditions.
        AllConditionsFulfiled = FinishArea.IsFinished;

        
        if (AllConditionsFulfiled) state = GameSate.Win;
        else state = GameSate.Playing;

    }
 private void PauseGame()
 {
     currentGameState = GameSate.Paused;
 }
Esempio n. 14
0
 void Start()
 {
     Application.targetFrameRate = gameSettings.TargerFPS;
     currentGameState            = GameSate.INTRO;
     StartCoroutine(PlayState("Intro"));
 }
 private void Play()
 {
     while (true)
     {
         switch (currentGameState)
         {
             case GameSate.PreLoad:
                 currentGameState = GameSate.MainMenu;
                 break;
             case GameSate.MainMenu:
                 MainMenu();
                 break;
             case GameSate.Playing:
                 PlayGame();
                 break;
             case GameSate.Paused:
                 PauseGame();
                 break;
             case GameSate.GameOver:
                 GameOver();
                 break;
             case GameSate.Quit:
                 QuitGame();
                 break;
             default:
                 break;
         }
     }
 }
        private void PlayGame()
        {
            currentGameState = GameSate.Playing;

            _deck.ShowCards();

            //
        }
 private void QuitGame()
 {
     currentGameState = GameSate.Quit;
 }