Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     GMState     = GameManagerState.Opening;
     GameDataGO  = GameObject.FindGameObjectWithTag("GameData");
     GlobalTimer = 0;
     StartGamePlay();
 }
Ejemplo n.º 2
0
 //game count down
 IEnumerator StartGameOver()
 {
     CanIStart = false;
     GameState = GameManagerState.GameOver;
     UpdateGameState();
     yield return(new WaitForSeconds(0));
 }
Ejemplo n.º 3
0
 public void StartGamePlay()
 {
     SelectLevel.SetActive(false);
     GMState = GameManagerState.Gameplay;
     UpdateGameManagerState();
     Background.transform.position = new Vector3(11.6f, 20.6f, 19.2f);
 }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     Instance              = this;
     is2PlayerGame         = twoPlayerMode;
     GMState               = GameManagerState.Opening;
     activeCounterMeasures = 0;
 }
Ejemplo n.º 5
0
    /// <summary>
    /// Control this instance.
    /// </summary>
    void Control()
    {
        switch (_currentState)
        {
        case GameManagerState.START:
            break;

        case GameManagerState.PLAYING:
            if (_currentLife <= 0)
            {
                _currentState = GameManagerState.FINISH;
                return;
            }
            StartCoroutinesForSpawn();
            break;

        case GameManagerState.FINISH:
            Debug.Log("Game has finished, todo the end screen");
            textMng.FinishScreen();
            StartCoroutine("WaitForReturnToMainMenu");

            break;

        default:
            Debug.LogWarning("State not defined!");
            _currentState = GameManagerState.START;
            break;
        }
    }
Ejemplo n.º 6
0
 public GetMoveState(GameManagerState state, [NotNull] GameBoard activeBoard)
 {
     _cancellationTokenSource = new CancellationTokenSource();
     State       = state;
     ActiveBoard = activeBoard.EnsureNotNull();
     IsCancelled = new SyncValueContainer <bool>();
 }
Ejemplo n.º 7
0
 public void StartGamePlay()
 {
     timeCounter.GetComponent <TimeCounter>().StartTimeCounter();
     GMState = GameManagerState.Gameplay;
     UpdateGameManagerState();
     player.GetComponent <PlayerController>().ResetPlayer();
 }
Ejemplo n.º 8
0
        public bool UndoLastMoves(int moveCount)
        {
            if (moveCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(moveCount), moveCount, @"The value must be positive.");
            }

            lock (_syncLock)
            {
                if (_isDisposed || _gameBoards.Count <= moveCount)
                {
                    return(false);
                }

                var originalState = _state == GameManagerState.GameFinished ? GameManagerState.Running : _state;
                _state = GameManagerState.Paused;

                var getMoveState = _getMoveStateContainer.Value;
                if (getMoveState != null)
                {
                    getMoveState.Cancel();
                    _getMoveStateContainer.Value = null;
                }

                for (var index = 0; index < moveCount; index++)
                {
                    _gameBoards.Pop();
                }

                AffectStates(originalState);
            }

            return(true);
        }
Ejemplo n.º 9
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        GMState = GameManagerState.StartState;
        if (player != null && playCont != null)
        {
            playCont = player.GetComponent <Player_Controller>();
        }
        else
        {
            player = GameObject.FindGameObjectWithTag("Player");
            if (player != null)
            {
                playCont = player.GetComponent <Player_Controller>();
            }
        }
    }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     health         = MaxHealth;
     animator       = GetComponent <Animator>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     GMState        = GameManagerState.Find;
 }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     //Screen.autorotateToPortrait = false;
     //Screen.autorotateToPortraitUpsideDown = false;
     charID  = 0;
     GMState = GameManagerState.Opening;
     UpdateGameManagerState();
 }
Ejemplo n.º 12
0
 public void StarGamePlay()
 {
     GMState = GameManagerState.GamePlay;
     skor    = 0;
     UpdateGameManagerState();
     GameOver.SetActive(false);
     MainFrame.SetActive(true);
 }
Ejemplo n.º 13
0
 public void ChangeGameState(GameManagerState state)
 {
     if (state == GameManagerState.ActivePlay)
     {
         m_loGameState = m_lightsOutDefinition.gameBuilder.Create(m_lightsOutDefinition.gameBoard, m_gameInitData);
     }
     OnGameManagerStateChanged?.Invoke(state);
     OnGameStateChanged?.Invoke(m_loGameState);
 }
Ejemplo n.º 14
0
    //methods used to switch between scenes
    public void SceneSwitcher(gameState stateToSwitchTo)
    {
        string stateString = possibleStateStrings[(int)stateToSwitchTo];

        SceneManager.LoadScene(stateString);
        currentGameStateEnum = stateToSwitchTo;
        currentState         = possibleStates[(int)stateToSwitchTo];
        runStart             = true;
    }
Ejemplo n.º 15
0
        public void Pause()
        {
            lock (_syncLock)
            {
                EnsureNotDisposed();

                _state = GameManagerState.Paused;
            }
        }
Ejemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     GMState = GameManagerState.Opening;
     //esconde botão Score
     scoreUITextGO.SetActive(false);
     scoreUI.SetActive(false);
     livesUITextGO.SetActive(false);
     livesUI.SetActive(false);
 }
Ejemplo n.º 17
0
 private void Update()
 {
     if (CountWin >= 10)
     {
         Debug.Log("WIN");
         GMState = GameManagerState.Victory;
         UpdateGameManagerState();
     }
 }
Ejemplo n.º 18
0
 private void Login(string loginEmail, string loginPassword)
 {
     _state = GameManagerState.Sending;
     _photonPeer.OpCustom((byte)GameOperationCode.Login,
                          new Dictionary <byte, object>
     {
         { (byte)GameOperatorCodeParameter.Email, loginEmail },
         { (byte)GameOperatorCodeParameter.Password, loginPassword }
     }, true);
 }
Ejemplo n.º 19
0
 void Start()
 {
     score.RestartScore();
     AudioManager.instance.PlayMusic(gameMusic, 2);
     Cursor.visible = false;
     highScoreUI.GetComponent <GameObject>();
     score.GetComponent <GameScore>();
     Time.timeScale = (active) ? 0 : 1f;
     GMState        = GameManagerState.Gameplay;
 }
Ejemplo n.º 20
0
    IEnumerator WaitForReturnToMainMenu()
    {
        yield return(new WaitForSecondsRealtime(3.0f));

        Debug.Log("Loading Scene...");
        _currentState = GameManagerState.START;
        StopAllCoroutines();
        Application.LoadLevel(0);
        //SceneManager.LoadScene("MainMenu");
    }
Ejemplo n.º 21
0
 private void Register(string username, string password, string email)
 {
     _state = GameManagerState.Sending;
     _photonPeer.OpCustom((byte)GameOperationCode.Register,
                          new Dictionary <byte, object>
     {
         { (byte)GameOperatorCodeParameter.Email, email },
         { (byte)GameOperatorCodeParameter.Password, password },
         { (byte)GameOperatorCodeParameter.Username, username }
     }, true);
 }
Ejemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        CountWin = 0;
        GMState  = GameManagerState.Gameplay;
        Debug.Log("c");
        Lives.SetActive(false);
        Debug.Log("d");

        Background.SetActive(true);
        playerShip.GetComponent <PM>().init();
        enemySpawnner.GetComponent <EnemySpawnner2>().ScheduleEnemySpawner();
    }
Ejemplo n.º 23
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         Quit();
     }
     if (timeCounter.GetComponent <TimeCounter>().timeUp)
     {
         GMState = GameManagerState.Timeup;
         UpdateGameManagerState();
     }
 }
Ejemplo n.º 24
0
        private void HandleGameManagerStateChange(GameManagerState gameManagerState)
        {
            if (gameManagerState == GameManagerState.ActivePlay)
            {
                SetAllInteraction(true);
            }

            if (gameManagerState == GameManagerState.ResultsDisplay)
            {
                SetAllInteraction(false);
            }
        }
Ejemplo n.º 25
0
    private void Login(string email, string password)
    {
        _state = GameManagerState.Sending;

        _photonPeer.OpCustom(
            (byte)RuneOperationCode.Login,
            new Dictionary <byte, object>()
        {
            { (byte)RuneOperationCodeParameter.Password, password },
            { (byte)RuneOperationCodeParameter.Email, email }
        },
            true);
    }
Ejemplo n.º 26
0
        private void Start()
        {
            ExceptionHandle.SetupExceptionHandling();

            if (SceneTransporter.CurrentGame == null)
            {
                SceneManager.LoadScene("Scene/TestScene");
                return;
            }


            State = GameManagerState.Unknown;

            StartCoroutine(Init());
        }
Ejemplo n.º 27
0
        private void HandleGameManagerStateChange(GameManagerState gameManagerState)
        {
            if (gameManagerState == GameManagerState.ActivePlay)
            {
                ResetHUD();
                m_doUpdateTimer = true;
            }

            if (gameManagerState == GameManagerState.ResultsDisplay)
            {
                m_resetButtonText.text = "Play Again";
                m_doUpdateTimer        = false;
                m_winText.gameObject.SetActive(true);
            }
        }
Ejemplo n.º 28
0
        public void UpdateVisualisation(byte envStatus, GameManagerState GameState,
                                        MoreOrLess.InternalState internalState, int accessCode, Question _currentQuestion,
                                        AnswerParameters _currentAnswer, int nScore,
                                        int nTotalGameSecs, int nRemainingSecs, int nRemainingQuestionSecs)
        {
            VisualisationData vd = new VisualisationData();

            vd.EnvironmentStatus = envStatus;
            vd.GameState         = GameState.ToString();
            vd.GameStateInt      = (int)GameState;
            vd.InternalState     = internalState.ToString();
            vd.InternalStateInt  = (int)internalState;
            vd.AccessCode        = accessCode;

            if (_currentQuestion != null)
            {
                vd.currentQuestion = _currentQuestion;
            }

            if (_currentAnswer != null)
            {
                vd.currentQuestionMin = _currentAnswer.GetMin();
                vd.currentQuestionMax = _currentAnswer.GetMax();
                vd.currentAnswerLo    = _currentAnswer.GetLo();
                vd.currentAnswerHi    = _currentAnswer.GetHi();
                vd.PotentialScore     = _currentAnswer.GetPotentialPoints();
            }

            vd.Score                 = nScore;
            vd.TotalGameSecs         = nTotalGameSecs;
            vd.RemainingSecs         = nRemainingSecs;
            vd.RemainingQuestionSecs = nRemainingQuestionSecs;

            WriteToVizServer(vd);

            if (m_bUseFileSystem)
            {
                if (!IsClientReceiving() || IsVisFileAlreadyPresent())
                {
                    _vdPending = vd;
                    _dogPendingUpdate.Reset();
                    return;
                }

                WriteToVizFile(vd);
            }
        }
Ejemplo n.º 29
0
    public void Start()
    {
        _registerEmail    = "";
        _registerPassword = "";
        _error            = "";
        _username         = "";
        _loginEmail       = "";
        _loginPassword    = "";
        _state            = GameManagerState.Form;

        _messages   = new List <string>();
        _photonPeer = new PhotonPeer(this, ConnectionProtocol.Udp);
        if (!_photonPeer.Connect("127.0.0.1:5055", "Runeslinger"))
        {
            Debug.LogError("Could not connect to photon");
        }
    }
Ejemplo n.º 30
0
    public void Start()
    {
        _photonPeer = new PhotonPeer(this, ConnectionProtocol.Udp);
        if (!_photonPeer.Connect("127.0.0.1:5055", "Game1Photon"))
        {
            Debug.LogError("Could not connect!");
        }


        _registerEmail    = "";
        _registerPassword = "";
        _username         = "";
        _error            = "";
        _loginEmail       = "";
        _loginPassword    = "";
        _state            = GameManagerState.Form;
    }
Ejemplo n.º 31
0
 // Use this for initialization
 void Start()
 {
     GMState = GameManagerState.GameStart;
 }
Ejemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     GMState = GameManagerState.Opening;
 }
Ejemplo n.º 33
0
 // Our player button will call this function
 // When the user clicks the button.
 public void StartGamePlay()
 {
     GMState = GameManagerState.GamePlay;
     UpdateGameManagerState();
 }
Ejemplo n.º 34
0
 // Function to set the game manager state
 public void SetGameManagerState(GameManagerState state)
 {
     GMState = state;
     UpdateGameManagerState();
 }