Esempio n. 1
0
    public void OnOpen(object data)
    {
        if (data == null)
        {
            Debug.LogErrorFormat("GameOverViewModule.Open(GameOverType)  is null ");
            return;
        }

        GameOverType type = (GameOverType)data;
        var          dic  = ViewTools.CollectAllGameObjects(m_gameObject);

        m_button = dic["GameOverButton"].GetComponent <Button>();
        if (m_button != null)
        {
            m_button.onClick.AddListener(OnClickButton);
        }

        m_winObj     = dic["win"];
        m_failureObj = dic["lose"];
        if (m_winObj != null)
        {
            m_winObj.SetActive(type == GameOverType.Win);
        }
        if (m_failureObj != null)
        {
            m_failureObj.SetActive(type == GameOverType.Failure);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 结束游戏
    /// 1.生命已耗尽 or
    /// 2.鸟窝已爆炸 or
    /// 3.时间已规0
    /// </summary>
    public void IsGameOvoer(GameOverType gameOverType)
    {
        m_IsGameOver         = true;
        UIManager.isGameOver = true;
        switch (gameOverType)
        {
        case GameOverType.notLife:
            UIManager.GetInstance.txt_GameOverCause.text = "死因:没有剩余生命";
            break;

        case GameOverType.coreDestory:
            try
            {
                GameObject core = GameObject.FindWithTag("Core");
                Debug.Log(core);
                core.GetComponent <SpriteRenderer>().sprite = eff_CoreDestory;
                Instantiate(go_Destory, core.transform.position, transform.rotation);
            }
            catch (System.Exception)
            {
                throw;
            }
            UIManager.GetInstance.txt_GameOverCause.text = "死因:鸟窝被毁";
            break;

        case GameOverType.notTime:
            UIManager.GetInstance.txt_GameOverCause.text = " 死因:规定时间内未歼灭敌人";
            break;

        default:
            break;
        }
    }
Esempio n. 3
0
 public void GameOver(GameOverType type)
 {
     MusicPlayer.Instance.PlayFail();
     TriggerForEnd.gameObject.SetActive(false);
     JayAudioManager.Instance.Stop();
     MainMenuManager.Instance.GameOver(type);
 }
Esempio n. 4
0
    public void EnableFruitRb()
    {
        switch (meterController.colorPicker)
        {
        case 1:
            for (int i = 0; i < fruitLists.Count; i++)
            {
                fruitLists[i].useGravity = true;
            }
            break;

        case 2:
            for (int i = 0; i < 2; i++)
            {
                fruitLists[i].useGravity = true;
            }
            gameOverType = GameOverType.Lose;
            break;

        case 3:
            fruitLists[0].useGravity = true;
            gameOverType             = GameOverType.Lose;
            break;
        }
        treeType++;
        Manager.sharedManager().isGameStarted = false;
        StartCoroutine(ChangeCamPosition());
    }
    void Awake()
    {
        Debug.Log(Application.persistentDataPath); ///AppData/LocalLow/DefaultCompany/Blackhole + ....
        configFile   = Application.persistentDataPath + "/config.dat";
        scoreFile    = Application.persistentDataPath + "/score.dat";
        GOTy         = GameOverType.NOTHING;
        ScoreNames   = new string[5];
        ScoreResults = new string[5];

        if (GameStats == null)
        {
            GameStats = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (GameStats != this)
        {
            Destroy(gameObject);
        }
        //if (InitialMusicScreen == null)
        //{
        //     == this;
        //    DontDestroyOnLoad(gameObject);
        //}else
        //{

        //}
    }
Esempio n. 6
0
        public void ShowGameOver(GameOverType type)
        {
            string message = string.Empty;
            Image  image;

            switch (type)
            {
            case GameOverType.Victory:
                message = UIConstants.MSG_VICTORY;
                image   = Properties.Resources.VictorySoldier;
                break;

            case GameOverType.VictoryCommander:
                message = UIConstants.MSG_VICTORY_COMMANDER;
                image   = Properties.Resources.VictoryCommander;
                break;

            case GameOverType.Defeat:
                message = UIConstants.MSG_DEFEAT;
                image   = Properties.Resources.Defeat;
                break;

            default:
                throw new InvalidEnumArgumentException();
            }

            btnClose.Image  = image;
            messageBox.Text = message;
            this.ShowDialog();
        }
Esempio n. 7
0
    IEnumerator ShowGameOverScreenAfterDelay(float delay, GameOverType type)
    {
        IsAlive = false;
        yield return(new WaitForSeconds(delay));

        ShowGameOverScreen(type);
    }
Esempio n. 8
0
    public void ShowEndScreen(GameOverType type)
    {
        endGameScreens[(int)type].SetActive(true);

        if (type == GameOverType.Lose)
            GameObject.Find("DefeatDescription").GetComponent<TextMeshProUGUI>().text = gameOverDescriptions[Random.Range(0, gameOverDescriptions.Length + 1)];
    }
Esempio n. 9
0
 private void OnChangeGameState(GameStates state, GameOverType gameOverType)
 {
     if (state == GameStates.GameOver)
     {
         _enemyTanksWidgetMediator.Reset();
     }
 }
Esempio n. 10
0
        public void GameOver(GameOverType gameOverType)
        {
            if (!useMecanim)
            {
                thisAnimation.Stop(runAnimationName);
            }

            if (gameOverType != GameOverType.Quit)
            {
                if (gameOverType == GameOverType.JumpObstacle)
                {
                    if (useMecanim)
                    {
                        thisAnimator.SetBool(forwardDeathAnimationName, true);
                    }
                    else
                    {
                        thisAnimation.CrossFade(forwardDeathAnimationName);
                    }
                }
                else
                {
                    if (useMecanim)
                    {
                        thisAnimator.SetBool(backwardDeathAnimationName, true);
                    }
                    else
                    {
                        thisAnimation.CrossFade(backwardDeathAnimationName);
                    }
                }
            }
        }
Esempio n. 11
0
    void Awake()
    {
        Instance        = this;
        m_allEntities   = new List <Entity>();
        m_activeEnemies = new List <Enemy>();
        m_activeNPCs    = new List <NPC>();
        m_player        = null;
        m_spawners      = new List <EnemySpawner>(FindObjectsOfType <EnemySpawner>());

        m_gameOver       = GameOverType.None;
        m_gameOverScreen = FindObjectOfType <GameOver>();
        if (m_gameOverScreen != null)
        {
            m_gameOverScreen.gameObject.SetActive(false);
        }

        m_killedCreatureCount = m_killedNPCCount = 0;
        m_spawnedCreatures    = m_spawnedNPCCount = 0;
        m_elapsed             = 0.0f;

        m_boundaries = new Rect();
        Camera cam        = Camera.main;
        float  camHHeight = cam.orthographicSize;
        float  camHWidth  = camHHeight * cam.aspect;

        cam.transform.position.Set(0, 0, cam.transform.position.z);
        m_boundaries.x      = -camHWidth;
        m_boundaries.width  = camHWidth * 2;
        m_boundaries.y      = 2 * camHHeight;
        m_boundaries.height = camHHeight * 4; // At the moment there are two areas on top of each other
    }
Esempio n. 12
0
    public void gameOver(GameOverType gameOverType, bool waitForFrame)
    {
        if (!gameActive && waitForFrame)
        {
            return;
        }
        gameActive = false;

        if (waitForFrame)
        {
            StartCoroutine(waitForFrameGameOver(gameOverType));
        }
        else
        {
            inputController.gameOver();
            // Mission Manager's gameOver must be called before the Data Manager's gameOver so the Data Manager can grab the
            // score multiplier from the Mission Manager to determine the final score
            missionManager.gameOver();
            dataManager.gameOver();
            playerController.gameOver(gameOverType);
            audioManager.playBackgroundMusic(false);
            audioManager.playSoundEffect(SoundEffects.GameOverSoundEffect);
            guiManager.gameOver();
//            cameraController.setPlayerAsParent(false);
        }
    }
Esempio n. 13
0
    public void SetGameOverType(GameOverType gameOver)
    {
        timer = Time.time;
        m_init = true;
        m_canvas.gameObject.SetActive(true);

        switch (gameOver)
        {
            case GameOverType.None:
                break;
            case GameOverType.PlayerDeath:
                m_Death.gameObject.SetActive(true);
                break;
            case GameOverType.Genocidal:
                m_Resistance.gameObject.SetActive(true);
                m_GenocidalSub.gameObject.SetActive(true);
                break;
            case GameOverType.Extermination:
                m_Extermination.gameObject.SetActive(true);
                break;
            case GameOverType.Resistance:
                m_Resistance.gameObject.SetActive(true);
                m_PacifistSub.gameObject.SetActive(true);
                break;
            case GameOverType.Psychopath:
                m_Resistance.gameObject.SetActive(true);
                m_PsychopathSub.gameObject.SetActive(true);
                break;
            default:
                break;
        }
    }
Esempio n. 14
0
 void ShowGameOverScreen(GameOverType type)
 {
     IsAlive = false;
     GameOverScreen.gameObject.SetActive(true);
     GameOverScreen.GetComponent <Animator>().SetTrigger("Appear");
     GameOverScreen.SetSprite(type);
     timer.Stop();
 }
Esempio n. 15
0
 public void gameOver(GameOverType gameOverType)
 {
     playerAnimation.gameOver(gameOverType);
     thisRigidbody.velocity = Vector3.zero;
     collisionParticleSystem.transform.parent = null;
     enabled = false;
     gameManager.onPauseGame -= gamePaused;
 }
Esempio n. 16
0
    void GameOverScreen(GameOverType winner)
    {
        timeText.transform.parent.gameObject.SetActive(false);
        gameUI.transform.Find("GameOver").gameObject.SetActive(true);
        Image gameOverBackground = gameUI.transform.Find("GameOver/Background").GetComponent <Image>();

        gameUI.transform.Find("GameOver/Game Over/Winner").GetComponent <Text>().text = winner == GameOverType.Bear ? "Bear Wins" : "Bear Loses";
        //gameOverBackground.sprite = Resources.Load<Sprite>(string.Format("GameOver_{0}", type.ToString()));
    }
Esempio n. 17
0
 public void GameOver(GameOverType gameOverType)
 {
     // attack
     if (gameOverType == GameOverType.DuckObstacle || gameOverType == GameOverType.JumpObstacle) {
         thisAnimation.Play(attackAnimationName);
         attackParticles.Play();
     } else {
         thisAnimation.Stop();
     }
 }
    private void GameOver(GameOverType gameOverType)
    {
        IsEnemySpawning = false;
        IsGameRunning   = false;

        ClearEnemies();
        if (OnGameOver != null)
        {
            OnGameOver(gameOverType);
        }
    }
 public void DisplayGameOver(float score, int days, GameOverType gameOverType)
 {
     _reasonDisplay.text = gameOverType switch
     {
         GameOverType.NoMoneyLeft => "You have no money left.",
         GameOverType.NoZoneleft => "There is no fishing zone left.",
         _ => "",
     };
     _scoreDisplay.text = string.Format("Total score: {0}", score);
     _dayDisplay.text   = string.Format("Total days: {0}", days);
 }
Esempio n. 20
0
 private void OnGameOver(GameOverType gameOverType)
 {
     if (gameOverType == GameOverType.Lose)
     {
         _musicSource.PlayOneShot(_settings.GameOverLose);
     }
     else if (gameOverType == GameOverType.Win)
     {
         _musicSource.PlayOneShot(_settings.GameOverWin);
     }
 }
Esempio n. 21
0
    // Game over may be called from a trigger so wait for the physics loop to end
    private IEnumerator waitForFrameGameOver(GameOverType gameOverType)
    {
        yield return(new WaitForEndOfFrame());

        gameOver(gameOverType, false);

        // Wait a second for the ending animations to play
        yield return(new WaitForSeconds(1.0f));

        guiManager.showGUI(GUIState.EndGame);
    }
Esempio n. 22
0
    private void SetGameOverCondition(GameOverType condition)
    {
        paused     = true;
        m_gameOver = condition;
        Debug.LogFormat("GAME OVER!! {0}", m_gameOver);

        for (int i = 0; i < m_allEntities.Count; ++i)
        {
            m_allEntities[i].OnGameOver(m_gameOver);
        }

        StartCoroutine(GameOverSequence());
    }
Esempio n. 23
0
 public void GameOver(GameOverType gameOverType)
 {
     // attack
     if (gameOverType == GameOverType.DuckObstacle || gameOverType == GameOverType.JumpObstacle)
     {
         thisAnimation.Play(attackAnimationName);
         attackParticles.Play();
     }
     else
     {
         thisAnimation.Stop();
     }
 }
Esempio n. 24
0
 public void GameOver(GameOverType gameOverType)
 {
     if (!isSliding && gameOverType != GameOverType.Pit)
     {
         playerAnimation.GameOver(gameOverType);
     }
     // ensure the player returns to their original color
     ActivatePowerUp(powerUpManager.GetActivePowerUp(), false);
     collisionParticleSystem.transform.parent = null;
     gameManager.OnPauseGame -= GamePaused;
     // let the character fall if they are still in the air
     jumpSpeed = 0;
     enabled   = InAir();
 }
Esempio n. 25
0
    public void gameOver(GameOverType gameOverType)
    {
        thisAnimation.Stop("Run");

        if (gameOverType != GameOverType.Quit)
        {
            if (gameOverType == GameOverType.JumpObstacle)
            {
                thisAnimation.Play("ForwardDeath");
            }
            else
            {
                thisAnimation.Play("BackwardDeath");
            }
        }
    }
Esempio n. 26
0
        private void OnGameOver(GameOverType gameOverType)
        {
            Debug.Log("OnGameOver");
            _pauseAndSettingsMediator.ViewVisible = false;
            _gameOverPanelMediator.ViewVisible    = true;
            _mainMenuMediator.ViewVisible         = false;
            _inGameGuiMediator.ViewVisible        = false;

            if (gameOverType == GameOverType.Win)
            {
                _gameOverPanelMediator.SetToWin();
            }
            else if (gameOverType == GameOverType.Lose)
            {
                _gameOverPanelMediator.SetToGameOver();
            }
        }
    // Token: 0x0600170F RID: 5903 RVA: 0x000C2A54 File Offset: 0x000C0C54
    private void UpdateSubtitle()
    {
        StudentScript component = this.Yandere.Senpai.GetComponent <StudentScript>();

        if (!component.Teacher && this.Yandere.Noticed)
        {
            this.Subtitle.color = new Color(this.Subtitle.color.r, this.Subtitle.color.g, this.Subtitle.color.b, 1f);
            GameOverType gameOverCause = component.GameOverCause;
            int          num           = 0;
            if (gameOverCause == GameOverType.Stalking)
            {
                num = 4;
            }
            else if (gameOverCause == GameOverType.Insanity)
            {
                num = 3;
            }
            else if (gameOverCause == GameOverType.Weapon)
            {
                num = 1;
            }
            else if (gameOverCause == GameOverType.Murder)
            {
                num = 5;
            }
            else if (gameOverCause == GameOverType.Blood)
            {
                num = 2;
            }
            else if (gameOverCause == GameOverType.Lewd)
            {
                num = 6;
            }
            this.Subtitle.text = this.NoticedLines[num];
            this.Subtitle.GetComponent <AudioSource>().clip = this.NoticedClips[num];
            this.Subtitle.GetComponent <AudioSource>().Play();
            return;
        }
        if (this.Headmaster)
        {
            this.Subtitle.color = new Color(this.Subtitle.color.r, this.Subtitle.color.g, this.Subtitle.color.b, 1f);
            this.Subtitle.text  = this.NoticedLines[8];
            this.Subtitle.GetComponent <AudioSource>().clip = this.NoticedClips[8];
            this.Subtitle.GetComponent <AudioSource>().Play();
        }
    }
Esempio n. 28
0
    public void SetSprite(GameOverType type)
    {
        switch (type)
        {
        case GameOverType.FinishWithoutBook: {
            Renderer.sprite = NoBook;
            break;
        }

        case GameOverType.HitByCar: {
            Renderer.sprite = CarHit;
            break;
        }

        case GameOverType.Timer: {
            Renderer.sprite = Timer;
            break;
        }

        case GameOverType.Success: {
            Renderer.sprite = Success;
            break;
        }

        case GameOverType.HitByBiker: {
            Renderer.sprite = BycicleHit;
            break;
        }

        case GameOverType.HitByCat: {
            Renderer.sprite = CatHit;
            break;
        }

        case GameOverType.HitByPidgeon: {
            Renderer.sprite = PidgeonHit;
            break;
        }

        default: {
            Renderer.sprite = Success;
            break;
        }
        }
    }
Esempio n. 29
0
        public void GameOver(GameOverType gameOverType, bool waitForFrame)
        {
            if (!gameActive && waitForFrame)
            {
                return;
            }
            gameActive = false;

            if (waitForFrame)
            {
                // mecanim doesn't trigger the event if we wait until the frame is over
                playerController.GameOver(gameOverType);
                StartCoroutine(WaitForFrameGameOver(gameOverType));
            }
            else
            {
                inputController.GameOver();
                // Mission Manager's gameOver must be called before the Data Manager's gameOver so the Data Manager can grab the
                // score multiplier from the Mission Manager to determine the final score
                missionManager.GameOver();
                coinGUICollection.GameOver();
                // Only call game over on the DataManager if there is no chance a revive is going to happen. We don't want to forget
                // the values stored in the data manager if a revive does happen
                if (!allowRevives || !dataManager.CanRevive() || !dataManager.CanPurchaseRevive())
                {
                    dataManager.GameOver();
                }
                if (playerController.enabled)
                {
                    playerController.GameOver(gameOverType);
                }
                if (chaseController != null)
                {
                    chaseController.GameOver(gameOverType);
                }
                audioManager.PlayBackgroundMusic(false);
                if (gameOverType != GameOverType.Quit)
                {
                    audioManager.PlaySoundEffect(SoundEffects.GameOverSoundEffect);
                }
                guiManager.GameOver();
                cameraController.GameOver(gameOverType);
            }
        }
Esempio n. 30
0
        public void GameOver(GameOverType state)
        {
            Debug.Log($"Player {_owner.Id} game over state: {state}");
            switch (state)
            {
            case GameOverType.Win:
                _owner.Bird.PlayWinAudio();
                break;

            case GameOverType.Loss:
                _owner.Bird.PlayLossAudio();
                break;

            case GameOverType.TimerUp:
                _owner.Bird.PlayLossAudio();
                break;
            }
            _gameOverState = state;
        }
Esempio n. 31
0
        // Game over may be called from a trigger so wait for the physics loop to end
        private IEnumerator WaitForFrameGameOver(GameOverType gameOverType)
        {
            yield return(new WaitForEndOfFrame());

            GameOver(gameOverType, false);

            // Wait a second for the ending animations to play
            yield return(new WaitForSeconds(1.0f));

            // Show the revive panel if respawns are enabled
            if (allowRevives && dataManager.CanRevive() && dataManager.CanPurchaseRevive())
            {
                guiManager.ShowGUI(GUIState.Revive);
            }
            else
            {
                guiManager.ShowGUI(GUIState.EndGame);
            }
        }
Esempio n. 32
0
    public void OnGameOver(GameOverType gameOverType)
    {
        if (m_opController != null)
        {
            m_opController.OnGameOver(gameOverType);
        }
        if (m_mapController != null)
        {
            m_mapController.OnGameOver(gameOverType);
        }
        if (m_cameraController != null)
        {
            m_cameraController.OnGameOver(gameOverType);
        }

        GameApp.UI.CloseView(ViewName.GameViewModule);
        GameApp.UI.OpenView(ViewName.GameOverViewModule, gameOverType);

        m_state = State.GameOver;
    }
Esempio n. 33
0
        public void GameOver(GameOverType gameOverType)
        {
            if (!useMecanim) {
                thisAnimation.Stop(runAnimationName);
            }

            if (gameOverType != GameOverType.Quit) {
                if (gameOverType == GameOverType.JumpObstacle) {
                    if (useMecanim) {
                        thisAnimator.SetBool(forwardDeathAnimationName, true);
                    } else {
                        thisAnimation.Play(forwardDeathAnimationName);
                    }
                } else {
                    if (useMecanim) {
                        thisAnimator.SetBool(backwardDeathAnimationName, true);
                    } else {
                        thisAnimation.Play(backwardDeathAnimationName);
                    }
                }
            }
        }
Esempio n. 34
0
        // Game over may be called from a trigger so wait for the physics loop to end
        private IEnumerator WaitForFrameGameOver(GameOverType gameOverType)
        {
            yield return new WaitForEndOfFrame();

            GameOver(gameOverType, false);

            // Wait a second for the ending animations to play
            yield return new WaitForSeconds(1.0f);

            // Show the revive panel if respawns are enabled
            if (allowRevives && dataManager.CanRevive() && dataManager.CanPurchaseRevive()) {
                guiManager.ShowGUI(GUIState.Revive);
            } else {
                guiManager.ShowGUI(GUIState.EndGame);
            }
        }
Esempio n. 35
0
        public void GameOver(GameOverType gameOverType, bool waitForFrame)
        {
            if (!gameActive && waitForFrame)
                return;
            gameActive = false;

            if (waitForFrame) {
                // mecanim doesn't trigger the event if we wait until the frame is over
                playerController.GameOver(gameOverType);
                StartCoroutine(WaitForFrameGameOver(gameOverType));
            } else {
                inputController.GameOver();
                // Mission Manager's gameOver must be called before the Data Manager's gameOver so the Data Manager can grab the
                // score multiplier from the Mission Manager to determine the final score
                missionManager.GameOver();
                coinGUICollection.GameOver();
                // Only call game over on the DataManager if there is no chance a revive is going to happen. We don't want to forget
                // the values stored in the data manager if a revive does happen
                if (!allowRevives || !dataManager.CanRevive() || !dataManager.CanPurchaseRevive())
                    dataManager.GameOver();
                if (playerController.enabled)
                    playerController.GameOver(gameOverType);
                if (chaseController != null)
                    chaseController.GameOver(gameOverType);
                audioManager.PlayBackgroundMusic(false);
                if (gameOverType != GameOverType.Quit)
                    audioManager.PlaySoundEffect(SoundEffects.GameOverSoundEffect);
                guiManager.GameOver();
                cameraController.GameOver(gameOverType);
            }
        }
Esempio n. 36
0
    private void SetGameOverCondition(GameOverType condition)
    {
        paused = true;
        m_gameOver = condition;
        Debug.LogFormat("GAME OVER!! {0}", m_gameOver);

        for (int i = 0; i < m_allEntities.Count; ++i)
        {
            m_allEntities[i].OnGameOver(m_gameOver);
        }

        StartCoroutine(GameOverSequence());
    }
Esempio n. 37
0
    public void gameOver(GameOverType gameOverType)
    {
#if !UNITY_3_5
        if (!useMecanim) {
#endif
            thisAnimation.Stop(runAnimationName);
#if !UNITY_3_5
        }
#endif

        if (gameOverType != GameOverType.Quit) {
            if (gameOverType == GameOverType.JumpObstacle) {
#if !UNITY_3_5
                if (useMecanim) {
                    StartCoroutine(playOnce(forwardDeathAnimationName));
                } else {
#endif
                    thisAnimation.Play(forwardDeathAnimationName);
#if !UNITY_3_5
                }
#endif
            } else {
#if !UNITY_3_5
                if (useMecanim) {
                    StartCoroutine(playOnce(backwardDeathAnimationName));
                } else {
#endif
                    thisAnimation.Play(backwardDeathAnimationName);
#if !UNITY_3_5
                }
#endif
            }
        }
    }
Esempio n. 38
0
 public void gameOver(GameOverType gameOverType)
 {
     if (!isSliding && gameOverType != GameOverType.Pit)
         playerAnimation.gameOver(gameOverType);
     // ensure the player returns to their original color
     activatePowerUp(powerUpManager.getActivePowerUp(), false);
     collisionParticleSystem.transform.parent = null;
     gameManager.onPauseGame -= gamePaused;
     // let the character fall if they are still in the air
     jumpSpeed = 0;
     enabled = inAir();
 }
Esempio n. 39
0
    public void GameOver(GameOverType type)
    {
        State = GameState.GameOver;
        GUIManager.Instance.UnactivatePauseButton();
        _playerManager.OnGameOver();
        //播放一些动画
        switch (type)
        {
            case GameOverType.Obstacle:
            {

                break;
            }
            case GameOverType.OutOfEdge:
            {
                break;
            }
        }
        ScoreManager.Instance.AddScoreToRecord(Distance);
        //停止滚动然后显示得分菜单
           StartCoroutine(GameGenerator.Instance.StopScrollingAndShowEnd(2.0f));
    }
Esempio n. 40
0
    void Awake()
    {
        Instance = this;
        m_allEntities = new List<Entity>();
        m_activeEnemies = new List<Enemy>();
        m_activeNPCs = new List<NPC>();
        m_player = null;
        m_spawners = new List<EnemySpawner>(FindObjectsOfType<EnemySpawner>());

        m_gameOver = GameOverType.None;
        m_gameOverScreen = FindObjectOfType<GameOver>();
        if (m_gameOverScreen != null)
        {
            m_gameOverScreen.gameObject.SetActive(false);
        }

        m_killedCreatureCount = m_killedNPCCount = 0;
        m_spawnedCreatures = m_spawnedNPCCount = 0;
        m_elapsed = 0.0f;

        m_boundaries = new Rect();
        Camera cam = Camera.main;
        float camHHeight = cam.orthographicSize;
        float camHWidth = camHHeight * cam.aspect;
        cam.transform.position.Set(0,0,cam.transform.position.z);
        m_boundaries.x = -camHWidth;
        m_boundaries.width = camHWidth * 2;
        m_boundaries.y = 2 * camHHeight;
        m_boundaries.height = camHHeight * 4; // At the moment there are two areas on top of each other
    }
Esempio n. 41
0
	// Game over may be called from a trigger so wait for the physics loop to end
    private IEnumerator waitForFrameGameOver(GameOverType gameOverType)
	{
		yield return new WaitForEndOfFrame();

        gameOver(gameOverType, false);

        // Wait a second for the ending animations to play
        yield return new WaitForSeconds(1.0f);

        guiManager.showGUI(GUIState.EndGame);
	}
Esempio n. 42
0
	public void gameOver(GameOverType gameOverType, bool waitForFrame)
	{
        if (!gameActive && waitForFrame)
            return;
        gameActive = false;

        if (waitForFrame) {
            // mecanim doesn't trigger the event if we wait until the frame is over
            playerController.gameOver(gameOverType);
            StartCoroutine(waitForFrameGameOver(gameOverType));
        } else {
            inputController.gameOver();
            // Mission Manager's gameOver must be called before the Data Manager's gameOver so the Data Manager can grab the 
            // score multiplier from the Mission Manager to determine the final score
            missionManager.gameOver();
            coinGUICollection.gameOver();
            dataManager.gameOver();
            if (playerController.enabled)
                playerController.gameOver(gameOverType);
            if (chaseController != null)
                chaseController.gameOver(gameOverType);
            audioManager.playBackgroundMusic(false);
            if (gameOverType != GameOverType.Quit)
                audioManager.playSoundEffect(SoundEffects.GameOverSoundEffect);
            guiManager.gameOver();
            cameraController.gameOver(gameOverType);
        }
	}
Esempio n. 43
0
 public void OnGameOver(GameOverType gameoverType)
 {
     m_body.velocity = Vector2.zero;
 }
Esempio n. 44
0
 public void gameOver(GameOverType gameOverType)
 {
     gameActive = false;
     GameManager.instance.onPauseGame -= gamePaused;	
 }