Example #1
0
    // Update is called once per frame
    void Update()
    {
        switch (game_state)
        {
        case GameState.WaitingCamera:
            if (my_camera.camera_state == CameraLogic.CameraState.Game)
            {
                game_state = GameState.Game;
            }
            else if (my_camera.camera_state == CameraLogic.CameraState.Overall)
            {
                game_state = GameState.NotPlaying;
            }
            break;

        case GameState.Game:
            ammoGeneration();
            healthManagement();
            if (winConditions())
            {
                youWin();
                return;
            }
            //wave management doit être après conditions victoire
            wavesManagement();
            if (isWaveFinishedEarly())
            {
                launchNextWave();
            }
            break;

        case GameState.Injection:
            if (syringe.syringe_mode == Syringe.SyringeMode.Done)
            {
                syringe.Initialize();
                game_state = GameState.Game;
            }
            else
            {
                syringe.update_injection();
            }
            break;

        case GameState.Pause:
            break;

        case GameState.NotPlaying:
            break;
        }
        itemsManagement();
        UIManagement();

        if (game_state != GameState.Pause)
        {
            my_camera.update_camera();
        }

        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (game_state == GameState.Game || game_state == GameState.Injection)
            {
                pause_canvas.Activate(true);
                game_state = GameState.Pause;
                player.GetComponent <Rigidbody2D>().velocity = new Vector2(0.0f, 0.0f);
            }
            else if (game_state == GameState.Pause)
            {
                pause_canvas.ButtonResumeClicked();
            }
        }
    }