Ejemplo n.º 1
0
    void Update()
    {
        if (serverShip == null || clientShip == null)
        {
            gameOverCanvas.SetActive(true);
            GameOverUI gameOverUI = gameOverCanvas.GetComponent <GameOverUI>();

            if (serverShip == null)
            {
                if (NetworkManager.Instance.isServer)
                {
                    gameOverUI.youLost.SetActive(true);
                }
                else
                {
                    gameOverUI.youWon.SetActive(true);
                }
            }
            else
            {
                if (NetworkManager.Instance.isServer)
                {
                    gameOverUI.youWon.SetActive(true);
                }
                else
                {
                    gameOverUI.youLost.SetActive(true);
                }
            }
        }
    }
Ejemplo n.º 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 3
0
    // Use this for initialization
    public void Setup(LevelManager _lm)
    {
        name = "UI";
        _levman = _lm;
        transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -100f);

        GameEventManager.GameStart += GameStart;
        GameEventManager.GameOver += GameOver;
        GameEventManager.Respawn += Respawn;

        _IngameUI = FETool.findWithinChildren(this.gameObject, "Ingame").GetComponent<IngameUI>();
        _GameOverUI = FETool.findWithinChildren(this.gameObject, "GameOver").GetComponent<GameOverUI>();
        _EntryUI = FETool.findWithinChildren(this.gameObject, "EntryMenu").GetComponent<EntryUI>();
        _EndGameUI = FETool.findWithinChildren(this.gameObject, "EndGame").GetComponent<EndGameUI>();
        BottomPos = FETool.findWithinChildren(gameObject, "BottomPos").transform;
        TopPos = FETool.findWithinChildren(gameObject, "TopPos").transform;

        _IngameUI.SetupSub(this);
        _IngameUI.Setup();
        _GameOverUI.SetupSub(this);
        _GameOverUI.Setup();
        _EntryUI.SetupSub(this);
        _EntryUI.Setup();
        _EndGameUI.SetupSub(this);
        _EndGameUI.Setup();

        if (_lm._profile.SETUP.GameType == GameSetup.versionType.Demo)
        {
            _IngameUI.initPos = IngamePlaceDemo;
            _GameOverUI.lbInitpos = LeaderboardPlaceDemo;
            _EndGameUI.lbInitpos = LeaderboardPlaceDemo;
        }
    }
Ejemplo n.º 4
0
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    void Awake()
    {
        Instance = this;
        Hide();

        retry.onClick.AddListener(RetryGame);
        exit.onClick.AddListener(ExitGame);
    }
Ejemplo n.º 6
0
 public override void Enter()
 {
     GameObject gameOverObject = UIManager.GetInstance().InstantiateForegroundUI(UIManager.GetInstance().GameOverUI);
     _gameOverUI = gameOverObject.GetComponent<GameOverUI>();
     _gameOverUI.Init(_score);
     _gameOverUI.MainMenuPressed += OnMainMenuPressed;
     _gameOverUI.RetryPressed += OnRetryPressed;
 }
Ejemplo n.º 7
0
    /// <summary>
    /// Окончание игры
    /// </summary>
    public void GameOver()
    {
        GameStarted = false;

        //Перейти
        Hide();
        GameOverUI.Open();
    }
Ejemplo n.º 8
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance = this;
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     timeScale = Utils.getTimeScale();
     if (gameOver == null)
     {
         gameOver = GameObject.Find("GameOverMenu").GetComponentInChildren <GameOverUI>();
     }
 }
Ejemplo n.º 10
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     Car.LoadContent(Content);
     ScoreUI.LoadContent(Content);
     GameOverUI.LoadContent(Content);
     FPSUI.LoadContent(Content);
     CountdownUI.LoadContent(Content);
     TitleUI.LoadContent(Content);
     //TODO: probably should load ALL content here. Some content (e.g. sign models) still loaded at runtime
 }
Ejemplo n.º 11
0
 void Start()
 {
     PauseMenuUI.SetActive(false);
     CountdownUI.SetActive(true);
     ControlsUI.SetActive(false);
     MenuCheckUI.SetActive(false);
     GameOverUI.SetActive(false);
     StartCoroutine(GameCountDown());
     GameIsPaused = false;
     gameStarted  = false;
 }
 // Update is called once per frame
 void Update()
 {
     if (count >= 3)
     {
         Scorekeeper.instance.AddScore(20);
         Scorekeeper.instance.FinalScore();
         GameOverUI.SetActive(true);
         Destroy(BossRef);
         this.enabled = false;
     }
 }
Ejemplo n.º 13
0
    public override void Execute(object data = null)
    {
        GameModel  gameModel  = GetModel <GameModel>();
        GameOverUI gameOverUI = GetView <GameOverUI>();

        gameOverUI.Show();
        gameModel.IsOver = true;
        //gameModel.IsPause = true;
        //Time.timeScale = 0;
        GameSetting.Instance.playSound.PauseBgAudio();
        GameSetting.Instance.playSound.PauseStepAudio();
    }
Ejemplo n.º 14
0
 void Start()
 {
     SetGameOverVisible(true);
     updater             = GameObject.FindGameObjectWithTag("Updater");
     score               = 0;
     currentrestDelay    = resetDelay;
     levelCompleteUIFade = levelCompleteUI.transform.Find("Panel").gameObject.GetComponent <Image>();
     SceneTransition     = sceneTransUI.transform.Find("Panel").gameObject.GetComponent <Image>();
     controller          = GameObject.FindGameObjectWithTag("GunParent").GetComponent <GunController>();
     main.Play();
     GameOverUI.SetActive(false);
 }
Ejemplo n.º 15
0
    IEnumerator gameOveranims()
    {
        yield return(new WaitForSeconds(2));

        GameOverUI.SetActive(true);
        yield return(new WaitForSeconds(1.5f));

        soundManager.instance.playSound(gameOverSounds);
        youScored.text = "You scored <color=red> " + Player.instance.score + "</color>";
        yield return(new WaitForSeconds(2));

        buttons.SetActive(true);
    }
Ejemplo n.º 16
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        BlockForBuilding.ranOutOfLives += GameLost;
    }
Ejemplo n.º 17
0
    private void Awake()
    {
        Instance = this;

        transform.Find("retryBtn").GetComponent <Button>().onClick.AddListener(() => {
            GameSceneManager.Load(GameSceneManager.Scene.GameScene);
        });
        transform.Find("mainMenuBtn").GetComponent <Button>().onClick.AddListener(() => {
            GameSceneManager.Load(GameSceneManager.Scene.MainMenuScene);
        });

        Hide();
    }
Ejemplo n.º 18
0
 /// <summary>
 /// Restart button click event listener. Starts game
 /// </summary>
 public void Restart()
 {
     ControlsUI.SetActive(false);
     WinnerUI.SetActive(false);
     PlayerObject.GetComponent <Player>().Restart();
     Spawner.GetComponent <EnemySpawner>().Restart();
     BackgroundUI.GetComponent <Image>().sprite = LevelOptions.Background;
     StartGameBtn.SetActive(false);
     if (_playerDead)
     {
         GameOverUI.SetActive(false);
         _playerDead = false;
     }
     OnHealthsUpdate(PlayerObject.GetComponent <Player>().hPoints);
 }
Ejemplo n.º 19
0
    void Awake()
    {
        current          = this;
        gameOverGraphics = GetComponentsInChildren <Graphic>();
        foreach (Graphic g in gameOverGraphics)
        {
            g.enabled = false;
        }

        selectables = GetComponentsInChildren <Selectable>();
        foreach (Selectable s in selectables)
        {
            s.enabled = false;
        }
    }
Ejemplo n.º 20
0
    IEnumerator HPDown()                                        //if HPDown is selected:
    {
        if (twranched == true)                                  //check see if twranched
        {
            GameOverUI.SetActive(true);
            CharacterControl.gameOver = true;
        }
        else if (twranched == false)                    //if not twranched, twranch and changes state
        {
            player.transform.localScale += new Vector3(0, -.2f);
            yield return(new WaitForSeconds(.5f));             //bug: probability of killing enemy before twranch can change to true

            twranched = true;
        }
        yield return(new WaitForFixedUpdate());
    }
Ejemplo n.º 21
0
 public GameController(
     IRunner runner,
     EnemyManager enemyManager,
     GameScene scene,
     Signals.PlayerDead playerDeadSignal,
     ScoreManager score,
     GameOverUI gameOverUI
     )
 {
     _runner           = runner;
     _enemyManager     = enemyManager;
     _playerDeadSignal = playerDeadSignal;
     _score            = score;
     _scene            = scene;
     _gameOverUI       = gameOverUI;
 }
Ejemplo n.º 22
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this);
        }

        HandUI     = handUI;
        ScoreUI    = scoreUI;
        GameOverUI = gameOverUI;
        TutorialUI = tutorialUI;
    }
Ejemplo n.º 23
0
    /// <summary>
    /// Initialize component
    /// </summary>
    private void Start()
    {
        if (!PlayerPrefs.HasKey("soundOff"))
        {
            PlayerPrefs.SetInt("soundOff", 1);
            PlayerPrefs.Save();
        }

        audioSource = gameObject.GetComponent <AudioSource>();

        if (PlayerObject != null)
        {
            Player.OnPlayerDead += GameOver;
            Player.OnScoreSet   += OnScoreUpdate;
            Player.OnHealthsSet += OnHealthsUpdate;
            Player.OnBuyBonus   += OnBuyBonus;
            PlayerObject.SetActive(false);
        }

        if (Spawner != null)
        {
            Spawner.GetComponent <EnemySpawner>().SetLevelSettings(LevelOptions);
            Spawner.SetActive(false);
        }

        if (GameOverUI != null)
        {
            GameOverUI.SetActive(false);
        }

        if (WinnerUI != null)
        {
            WinnerUI.SetActive(false);
        }

        if (MusicToggleUI != null)
        {
            musicToggleUI.GetComponent <Toggle>().isOn = PlayerPrefs.GetInt("soundOff") == 1;
            if (!musicToggleUI.GetComponent <Toggle>().isOn)
            {
                var clip = Soundtrack.ElementAt(0);
                audioSource.clip = clip;
                audioSource.loop = true;
                audioSource.Play();
            }
        }
    }
Ejemplo n.º 24
0
    void HealthDrop(float amt)
    {
        t         = 0f;
        newHealth = currHealth + amt;
        if (newHealth <= 0f)
        {
            //show game over stuff
            //check if highscore, overwrite if so.
            GameObject.FindObjectOfType <HighScore>().SubmitNewScore(score);
            //show game over screen
            GameOverUI.SetActive(true);
            GameOverUI.transform.Find("HS").GetComponent <Text>().text = "Your Score: " + score + "\nHigh Score: " + PlayerPrefs.GetInt("highestScore");

            paused = true;
            //StartCoroutine (RestartGame ());
        }
    }
Ejemplo n.º 25
0
    private void EndGaming(MessageXieYi xieyi)
    {
        Debug.Log("结束游戏");
        CurrentPlayType = FramePlayType.游戏未开始;
        frameIndex      = 0;
        reConnectIndex  = 0;//游戏结束的时候未完成复现,则清除重连记录帧
        CameraManager.instance.SetCameraEnable(false);
        CameraManager.instance.SetCameraFollow(transform);
        foreach (var item in memberGroup)
        {
            item.Value.Init(item.Key);
        }
        GameRunUI.Close();
        TeamType winTeam = (TeamType)int.Parse(SerializeHelper.ConvertToString(xieyi.MessageContent));

        RoomUI.Show();
        GameOverUI.Show(winTeam);
    }
Ejemplo n.º 26
0
    // obje kacirildiginda cagirilir
    public void HealthLose()
    {
        health--;
        star[health].SetActive(false);

        // tum canlar bittiginde Game Over olmasini saglar
        if (health <= 0)
        {
            Destroy(GameObject.Find("Spawner"));
            gameManager.SetActive(false);
            gameOverPanel.SetActive(true);
            gameOverUI = FindObjectOfType <GameOverUI>();
            gameOverUI.SetScore(score);
            score  = 0;
            health = star.Length;
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 27
0
    // Use this for initialization
    void Start()
    {
        gameOverUI = gameOverObj.GetComponent <GameOverUI>();


        //	dataMgrBtn.SetActive(false);


        gameTip = transform.Find("Tip").GetComponent <Tip>();


        //gameStart();


        //GameMgr.inst().setGameState(gameState.mainUI);
        //GameMgr.inst().curGameMode = GameMode.none;

        //updateDiamondTxt(GameMgr.inst().diamondNum);
    }
Ejemplo n.º 28
0
    public void resetToInit()
    {
        tracking = true;
        ticks = 0f;
        interval = baseInterval;
        range = Mathf.Abs (outerStartPercent - targetPercent);

        if (gameOverUI == null) {
            gameOverUI = GameObject.Find("GameOverTitle").GetComponent<GameOverUI>();
        }

        if (smallRing == null) {
            smallRing = GameObject.Find("ProgressSmallRing");
        }

        GameObject shadowRing = GameObject.Find ("ProgressShadow");
        shadowRing.renderer.material.SetFloat("_Percent", outerStartPercent);

        smallRing.SetActive(false);
    }
Ejemplo n.º 29
0
    private void Awake()
    {
        Instance = this;

        transform.Find("restartBtn").GetComponent <Button>().onClick.AddListener(() => {
            GameSceneManager.Load("Level1");
            if (Scoreboard.Instance != null)
            {
                Scoreboard.Instance.scoreNumber = 0;
            }
            PlayerPrefs.SetInt("CurrentScore", 0);
            Scoreboard.Instance.SubtractScore();
        });
        transform.Find("quitBtn").GetComponent <Button>().onClick.AddListener(() => {
            GameSceneManager.Load("MainMenuScene");
            PlayerPrefs.SetInt("CurrentScore", 0);
        });

        Hide();
    }
    public override void Execute(object data)
    {
        GameSetting.Instance.playSound.PlayBgAudio(Const.Bgm_ZhanDou);
        GameModel      gameModel      = GetModel <GameModel>();
        GameOverUI     gameOverUI     = GetView <GameOverUI>();
        ContinueGameUI continueGameUI = GetView <ContinueGameUI>();

        if ((bool)data)
        {
            gameModel.IsOver = false;
            //gameModel.IsPause = false;
            GameSetting.Instance.playSound.PlayStepAudio();
        }
        else
        {
            gameModel.IsOver = true;
            //Time.timeScale = 1;
            gameOverUI.Hide();
            continueGameUI.Show("payContinue");
        }
    }
Ejemplo n.º 31
0
    /// <summary>
    /// OnPlayerDead event listener
    /// </summary>
    private void GameOver()
    {
        if (!_playerDead)
        {
            _playerDead = true;
            if (StartGameBtn != null && !StartGameBtn.activeSelf)
            {
                StartGameBtn.SetActive(true);
            }

            if (GameOverUI != null)
            {
                GameOverUI.SetActive(true);
            }

            if (ControlsUI != null)
            {
                ControlsUI.SetActive(true);
            }
        }
    }
    public void gameOver()
    {
        // transition to gameover screen
        gameStarted = false;
        GameObject[] uis = GameObject.FindGameObjectsWithTag("UI");
        foreach (GameObject u in uis)
        {
            Destroy(u);
        }
        GameObject[] baseshields;
        baseshields = GameObject.FindGameObjectsWithTag("BaseShield");
        foreach (GameObject bs in baseshields)
        {
            Destroy(bs);
        }
        if (!currentMystery.Equals(null))
        {
            Destroy(currentMystery);
            mysteryActive = false;
        }
        GameObject[] powerups;
        powerups = GameObject.FindGameObjectsWithTag("Powerup");
        foreach (GameObject p in powerups)
        {
            Destroy(p);
        }
        GameObject gameOverobj = Instantiate(gameOverUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        GameOverUI go_UI       = gameOverobj.GetComponent <GameOverUI>();

        go_UI.controller = gameObject.GetComponent <GameController>();
        for (int row = 0; row < 5; row++)
        {
            for (int col = 0; col < 11; col++)
            {
                Destroy(invaderArr[row, col].gameObject);
            }
        }
    }
Ejemplo n.º 33
0
    IEnumerator LoadPlayerData()
    {
        gameoverUI           = FindObjectOfType <GameOverUI>();
        backgroundController = FindObjectOfType <BackgroundBehaviour>();
        changeWaveUI         = FindObjectOfType <ChangeWaveUI>();
        lineRenderer.GetComponent <MouseMovement>().StreakUIController = FindObjectOfType <StreakUIController>();
        lineRenderer.GetComponent <MouseMovement>().mirrorLine.GetComponent <MirrorLineColliderScript>().streakController = FindObjectOfType <StreakUIController>();
        backgroundController.SetTheme();
        projGenerator.SetCurrentTheme();

        projesKilled     = 0;
        totalProjsKilled = 0;

        print("Loading player from " + Application.persistentDataPath);
        player.LoadPlayer();
        player.ChangeColorDependOnHP();

        curAmountOfProjs = 50; projGenerator.coldown = 1;
        for (int i = 2; i <= player.wave; i++)
        {
            curAmountOfProjs      += projsToAddPerWave + (int)(i * 0.5);
            projGenerator.coldown -= projGenerator.coldown * 0.03f;
        }

        for (int i = 0; i < blocks.Length; i++) //SKYBLOCKS
        {
            blocks[i].CalculateAmountOfHealth(player.wave);
        }
        bonusGenerator.ChangeBonusesDuration(player.wave);

        defendedProjsIndexes = projGenerator.CountDefendedAsteroidsAmount(curAmountOfProjs);
        changeWaveUI.StartCoroutine("ShowChangeWaveAnimation", player.wave);
        changingLevel = true;
        backgroundController.StartCoroutine("BackgroundAppear");
        yield return(new WaitForSeconds(changeWavePauseTime));

        changingLevel = false;
    }