Наследование: MonoBehaviour
Пример #1
0
    IEnumerator Example()
    {
        GameOverScript gos = gameOverPanel.GetComponent <GameOverScript>();

        //   gos.GetHighscores();

        Time.timeScale = 0;
        yield return(new WaitForSecondsRealtime(1.5f));

        //gameOverPanel.SetActive(true);
        black.CrossFadeAlpha(1.0f, 1, true);
        yield return(new WaitForSecondsRealtime(2.0f));

        //  prompt.SetActive(true);


        int isHighScore = gos.CheckIfHighscore(GameObject.FindGameObjectWithTag("Player").GetComponent <BeeManager>().CurrentScore);

        print(isHighScore);
        if (isHighScore == 1)
        {
            prompt.SetActive(true);
            prompt.GetComponentsInChildren <InputField>()[0].ActivateInputField();
            yield return(new WaitUntil(() => !prompt.activeInHierarchy));
        }



        highscore.SetActive(true);
        yield return(new WaitUntil(() => Input.GetKeyDown("return")));

        Time.timeScale = 1;
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
Пример #2
0
 void Start()
 {
     playerScript   = player.GetComponent <PlayerScript> ();
     gameManager    = GameObject.Find("GameManager");
     gameOverScript = gameManager.GetComponent <GameOverScript> ();
     messageScript  = gameManager.GetComponent <MessageScript> ();
 }
Пример #3
0
 void Start()
 {
     m_TimeUntilWingRotationChange = m_NumberOfFramesInWingMovement / 2;
     m_GameOverScript          = m_GameOverPanel.GetComponent <GameOverScript>();
     m_CountdownAnimatorScript = m_CountdownObject.GetComponent <CountdownAnimationManager>();
     m_RigidBody.constraints   = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotation;
 }
Пример #4
0
    public void closeDialog()
    {
        SoundCtrl.getInstance().playSoundUI();
        GameOverScript self = GetComponent <GameOverScript>();

        Destroy(self.continueGame);
        Destroy(self.jushuText);
        Destroy(self.singlePanel);
        Destroy(self.finalPanel);
        Destroy(self.shareSiganlButton);
        Destroy(self.continueGame);

        if (GlobalDataScript.singalGameOverList != null && GlobalDataScript.singalGameOverList.Count > 0)
        {
            for (int i = 0; i < GlobalDataScript.singalGameOverList.Count; i++)
            {
                //GlobalDataScript.singalGameOverList [i].GetComponent<GameOverScript> ().closeDialog ();
                Destroy(GlobalDataScript.singalGameOverList [i].GetComponent <GameOverScript>());
                Destroy(GlobalDataScript.singalGameOverList [i]);
            }
            int count = GlobalDataScript.singalGameOverList.Count;
            for (int i = 0; i < count; i++)
            {
                GlobalDataScript.singalGameOverList.RemoveAt(0);
            }
        }

        Destroy(this);
        Destroy(gameObject);
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     PlayerManager.S.gameState = 5;
     S         = this;
     winner    = CommunicationScript.S.winner;
     playerNum = PlayerManager.S.playerNum;
 }
Пример #7
0
 void Awake()
 {
     instance = this;
     // Disable them
     initial = gameObject;
     HideAll();
 }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     replay     = false;
     end        = this;
     source     = GetComponent <AudioSource>();
     transform1 = GetComponent <RectTransform>();
 }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        time = time - Time.deltaTime;

        minutes = Mathf.FloorToInt(time / 60);
        seconds = Mathf.FloorToInt(time % 60);

        minutes.ToString();
        seconds.ToString();

        if (time <= 1)
        {
            timer.text = "";
            GameOverScript.endGame();
        }

        if (seconds != 0)
        {
            timer.text = string.Concat(minutes, ":", seconds);
        }
        else
        {
            timer.text = string.Concat(minutes, ":00");
        }
        if (seconds < 10)
        {
            timer.text = string.Concat(minutes, ":0", seconds);
        }
    }
Пример #10
0
    void Start()
    {
        health = 100;
        score  = 0;
        updateScore();
        gameOver = false;



        GameObject gameControlObject = GameObject.FindWithTag("ui");

        if (gameControlObject != null)
        {
            gameOverScript = gameControlObject.GetComponent <GameOverScript>();
            healthInstance = healthBarController.GetComponent <HealthBarController>();
            healthInstance.setMaxHealth(100.0f);
            healthInstance.setHealth(100.0f);
        }
        if (gameControlObject == null)
        {
            Debug.Log("Sorry ,Couldn't find object");
        }
        StartCoroutine(SpawnWaves());
        StartCoroutine(spawnPowerUps());
    }
Пример #11
0
	void Update ()
    {
        /*if (HealthScript.playerIsDead)
        {
            gameOverScript.ShowGameOverScreen();
        }*/
        gameOverScript = GameObject.FindGameObjectWithTag("GameOverManager").GetComponent<GameOverScript>();
    }
Пример #12
0
 void Awake()
 {
     gameOver        = FindObjectOfType <GameOverScript>();
     timeStop        = GameObject.Find("TimeStop");
     timeStopImage   = timeStop.gameObject.GetComponent <Image>();
     shrinkItem      = GameObject.Find("ShrinkItem");
     shrinkItemImage = shrinkItem.gameObject.GetComponent <Image>();
 }
Пример #13
0
 public void Start()
 {
     pm        = FindObjectOfType <PlayerMoves>();
     go        = FindObjectOfType <GameOverScript>();
     sideBlock = GetComponentInChildren <BoxBlockSide>();
     rb        = gameObject.GetComponent <Rigidbody2D>();
     tr        = gameObject.GetComponent <Transform>();
     FreezeXandRot();
 }
Пример #14
0
    void Start()
    {
        clearCheckNum();
        Enemy = GameObject.Find("Enemy");
        Sound.LoadSe("bubbled", "bubbled");
        defaultColor = linePrefab.gameObject.GetComponent <SpriteRenderer>().color;
        clr          = defaultColor;

        gameOverScript = GameObject.Find("GameManager").GetComponent <GameOverScript> ();
    }
Пример #15
0
 /// <summary>
 /// Gets the game over script instance from the scene
 /// </summary>
 public static GameOverScript Get()
 {
     if (sm_gameOverScript == null)
     {
         sm_gameOverScript = FindObjectOfType <GameOverScript>();
         if (sm_gameOverScript == null)
         {
             Debug.LogError("Could not find Game Over Script in scene");
         }
     }
     return(sm_gameOverScript);
 }
Пример #16
0
 /// <summary>
 /// Gets the game over script instance from the scene
 /// </summary>
 public static GameOverScript Get()
 {
     if(sm_gameOverScript == null)
     {
         sm_gameOverScript = FindObjectOfType<GameOverScript>();
         if (sm_gameOverScript == null)
         {
             Debug.LogError("Could not find Game Over Script in scene");
         }
     }
     return sm_gameOverScript;
 }
Пример #17
0
 void Update()
 {
     if (count == 0)
     {
         gameWin = true;
         DisplayScore();
         if (Input.GetKeyDown(KeyCode.Space))
         {
             GameOverScript Object = new GameOverScript();
             Object.ResetGame();
         }
     }
 }
Пример #18
0
    // Start is called before the first frame update
    void Start()
    {
        //initial values for equipment for debugging and playtesting
        audioSource = GetComponent <AudioSource>();

        /*
         * PLAYER_HITPOINTS = 10;
         */

        lazersight = gameObject.GetComponent <LineRenderer>();

        gameover = (GameOverScript)Object.FindObjectOfType(typeof(GameOverScript));
    }
Пример #19
0
    // Use this for initialization
    void Start()
    {
        playerSprite      = gameObject.GetComponent <SpriteRenderer> ();
        animator          = gameObject.GetComponent <Animator> ();
        gameManager       = GameObject.Find("GameManager");
        gameOverScript    = gameManager.GetComponent <GameOverScript> ();
        gameManagerScript = gameManager.GetComponent <GameManagerScript> ();
        messageScript     = gameManager.GetComponent <MessageScript> ();

        regular = true;
        Sound.LoadSe("down", "down");
        Sound.LoadBgm("muteki", "muteki");
    }
    public void TakeDamage(float Damage)
    {
        hitpoint -= Damage;

        if (hitpoint == 0)
        {
            hitpoint       = 0;
            Time.timeScale = 0;

            script         = gameOver.GetComponent <GameOverScript>();
            script.enabled = true;
        }
        UpdateHealthbar();
    }
Пример #21
0
    public void Start()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            instance = this;
        }
        scorePanel.SetActive(false);
        scoreValue = 0;

        highScoreValue     = PlayerPrefs.GetInt("highscore", highScoreValue);
        highScoreText.text = "High Score: " + highScoreValue.ToString();
    }
    public void TakeDamage(float Damage)
    {
        hitpoint -= Damage;

        if (hitpoint == 0)
        {
            hitpoint       = 0;
            Time.timeScale = 0;

            script         = gameOver.GetComponent <GameOverScript>();
            script.enabled = true;

            //StartButton.active = true;
            //HighScoreButton.active = true;
            //ExitButton.active = true;
        }
        UpdateHealthbar();
    }
Пример #23
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (life <= 0)
        {
            GameOverScript.endGame();
        }

        float xOffset = 0.0f;

        for (int i = 0; i < hearts.Count; i++)
        {
            Vector3 temp = hearts[i].transform.position;
            temp.y = transform.position.y + 6.5f;
            temp.x = transform.position.x + 6.8f + xOffset;
            hearts[i].transform.position = temp;
            xOffset = xOffset + 0.7f;
        }
    }
Пример #24
0
    // Update is called once per frame
    void Update()
    {
        if (life <= 0)
        {
            GameOverScript.endGame();
            Time.timeScale = 0;
        }

        float xOffset = 0.0f;

        for (int i = 0; i < hearts.Count; i++)
        {
            Vector3 temp = hearts[i].transform.position;
            temp.y = transform.position.y + 4.31f;
            temp.x = transform.position.x + 5.0f + xOffset;
            hearts[i].transform.position = temp;
            xOffset = xOffset + 0.7f;
        }
    }
    void Start()
    {
        gOver = gameObject.GetComponent <GameOverScript>();

        anim = GetComponent <Animator>();

        // will rotate in relation to the camera's y axis, used to rotate player
        screenMovementSpace = Quaternion.Euler(0, Camera.main.transform.eulerAngles.y, 0);

        //Moving forwards or backwards on the z axis

        screenMovementForward = screenMovementSpace * Vector3.forward;


        //moving left or right on the x axis
        screenMovementRight = screenMovementSpace * Vector3.right;



        //sets minimap Camera
        minimapCamera = GameObject.FindGameObjectWithTag("MinimapCamera").GetComponent <Camera>();


        selectSurvivorName     = GameObject.Find("SurvivorName").GetComponent <Text>();
        selectSurvivorHealth   = GameObject.Find("SurvivorHealth").GetComponent <Text>();
        selectSurvivorStaminia = GameObject.Find("SurvivorStamina").GetComponent <Text>();
        selectSurvivorAccuracy = GameObject.Find("SurvivorAccuracy").GetComponent <Text>();

        foreach (GameObject item in GameObject.FindGameObjectsWithTag("Survivor"))
        {
            AddSurvivor(item);
            if (selectedSurvivor == null)
            {
                selectedSurvivor = item;

                selectedMotor   = selectedSurvivor.GetComponent <SurvivorMovement>();
                SurvivorDetails = selectedSurvivor.GetComponent <Survivor>();
                selectedSurvivor.GetComponent <SurvivorMovement>().isSelected = true;
                Debug.Log("select");
                UpdateUIInfo();
            }
        }
    }
Пример #26
0
    public void closeDialog()
    {
        GameOverScript self = GetComponent <GameOverScript> ();

        Destroy(self.continueGame);
        Destroy(self.finalEndPanel);
        Destroy(self.jushuText);
        Destroy(self.signalEndPanel);
        Destroy(self.finalEndPanel);
        Destroy(self.shareSiganlButton);
        Destroy(self.continueGame);
        Destroy(self.shareFinalButton);
        Destroy(self.button_Delete);

        Destroy(self.panelJingArray);
        Destroy(self.panelJingArraysh);

        // Add by Shise  BGM
        SoundCtrl.getInstance().playBGM(2);
        // End


        if (GlobalDataScript.singalGameOverList != null && GlobalDataScript.singalGameOverList.Count > 0)
        {
            for (int i = 0; i < GlobalDataScript.singalGameOverList.Count; i++)
            {
                //GlobalDataScript.singalGameOverList [i].GetComponent<GameOverScript> ().closeDialog ();
                Destroy(GlobalDataScript.singalGameOverList[i].GetComponent <GameOverScript>());
                Destroy(GlobalDataScript.singalGameOverList [i]);
            }
            int count = GlobalDataScript.singalGameOverList.Count;
            for (int i = 0; i < count; i++)
            {
                GlobalDataScript.singalGameOverList.RemoveAt(0);
            }
        }

        Destroy(this);
        Destroy(gameObject);
        //Destroy (GlobalDataScript.gamePlayPanel);
        SoundCtrl.getInstance().playSoundByActionButton(1);
    }
Пример #27
0
    void Awake()
    {
        Time.timeScale = 1;

        if (_instance == null)
        {
            _instance = new GameManagerScript();
        }

        GameObject[] gameManagers = GameObject.FindGameObjectsWithTag("GameManager");

        if (gameManagers.Length > 1)
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(this.gameObject);

        spawnPosition = new Vector3(27f, -0.88f, 28.5f);

        gameOverScript = GameObject.FindGameObjectWithTag("GameOverManager").GetComponent<GameOverScript>();
        playerGameObject = GameObject.FindGameObjectWithTag("Player");
        checkpointScript = GameObject.FindGameObjectWithTag("Checkpoint").GetComponent<CheckPointScript>();

        if (gameOverScript != null)
        {
            gameOverScript.HideGameOverScreen();
        }

        if (checkpointScript.checkpointPassed)
        {
            spawnPosition = checkpointScript.initialSpawnPosition;
        }

        /*if (!CharacterThirdPerson.gameHasRestarted)
        {
            playerGameObject.transform.position = spawnPosition;
        }*/
    }
Пример #28
0
    public static void setActiveSprite(int choice)
    {
        ballStates[0] = true;
        ballStates[1] = true;
        DialogScript dialogScript = new DialogScript();

        if (ballStates[choice])
        {
            selectedSpriteIndex = choice;
            string key = "ballSpriteIndex";
            PlayerPrefs.SetInt(key, selectedSpriteIndex);
        }
        else
        {
            int cost;
            if (choice < 10)
            {
                cost = 100;
            }
            else
            {
                cost = 200;
            }
            int coins;
            coins = GameOverScript.getCoins();
            if (coins >= cost)
            {
                coins -= cost;
                string key = "coins";
                PlayerPrefs.SetInt(key, coins);
                ballStates[choice] = true;
                PlayerPrefs.SetInt(ballKeys[choice], 1);
            }
            else if (coins < cost)
            {
                dialogScript.showDialog("You don't have enough coins. Sorry");
            }
        }
    }
Пример #29
0
    /// <summary>
    /// Initialises the game mode manager
    /// </summary>
    void Start()
    {
        if (!Utilities.IsOpenLeveL(Utilities.GetLoadedLevel()))
        {
            m_networkedState = GameState.STAGE_1;
            m_state          = GameState.STAGE_1;

            m_countdownTimer = FindObjectOfType <GUITimer>();
            if (m_countdownTimer == null)
            {
                Debug.LogError("Could not find GUI Count down timer");
            }
        }

        m_islandList = GameObject.FindObjectsOfType <IslandDiscoveryTrigger>();
        if (m_islandList.Length == 0)
        {
            Debug.LogError("Could not find any islands");
        }

        m_fogOfWar = FindObjectOfType <FogOfWar>();
        if (m_fogOfWar == null)
        {
            Debug.LogError("Could not find Fog of war");
        }

        m_stage1CountdownFinish = () =>
        {
            SwitchToState(GameState.STAGE_2);
            m_stateInitiatedByNetwork = false;
        };

        m_stage2CountdownFinish = () =>
        {
            GameOverScript.Get().SetLevelComplete();
        };
    }
 // Use this for initialization
 void Start()
 {
     lastSpawnTime = Time.time;
     gameManager   = GameObject.Find("GameMaster").GetComponent <GameManager>();
     gameOver      = GameObject.Find("GameMaster").GetComponent <GameOverScript>();
 }
Пример #31
0
 void FillCanvasVariables()
 {
     lifeText = GameObject.Find("life txt").GetComponent<Text>();
     guiScr = GameObject.Find("Menu").GetComponent<GuiScript>();
     soundManagerScr = GameObject.Find("BGM Manager").GetComponent<SoundManagerScr>();
     gameOverScr = GameObject.Find("Dying").GetComponent<GameOverScript>();;
 }
Пример #32
0
    void Start()
    {
        xRay = GameObject.FindGameObjectWithTag("XRay");
        xRay.SetActive(false);

        mgUpgrade += PlayerPrefsManager.GetUpgrade(UpgradeController.upgradeID.MACHINE_GUN_1);
        mgUpgrade += PlayerPrefsManager.GetUpgrade(UpgradeController.upgradeID.MACHINE_GUN_2);

        fireTimer = weapon[0].fireRate;
        gameOver = GameObject.Find("GameController").GetComponent<GameOverScript>();
        crosshair = GameObject.Find("Crosshair");
        highscore = GameObject.Find("Highscore").GetComponent<HighscoreScript>();

        rocketAmmo = PlayerPrefsManager.GetUpgrade(UpgradeController.upgradeID.ROCKET_AMMO);
        laserAmmo = PlayerPrefsManager.GetUpgrade(UpgradeController.upgradeID.PHASER_AMMO);

        useGazeControl = PlayerPrefsManager.GetControl();
    }
Пример #33
0
    // Use this for initialization
    void Start()
    {
        startTimer = false;

        menuObject = GameObject.FindGameObjectWithTag("Menus");
        menu = menuObject.GetComponent<GameOverScript>();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        score1Panel = GameObject.Find("Score 1 Panel");
        score2Panel = GameObject.Find("Score 2 Panel");
        score3Panel = GameObject.Find("Score 3 Panel");
        score4Panel = GameObject.Find("Score 4 Panel");

        temp1.Set(0, 6, 0);

        timeText.transform.position = temp1;

        if (clientManager.getNumberOfPlayers() == "2")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);

            score1Pos.Set(-3, 7, 0);
            score2Pos.Set(3, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "3")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);

            score1Pos.Set(-5, 7, 0);
            score2Pos.Set(0, 7, 0);
            score3Pos.Set(5, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
        }
        else if (clientManager.getNumberOfPlayers() == "4")
        {
            score1Panel.SetActive(true);
            score2Panel.SetActive(true);
            score3Panel.SetActive(true);
            score4Panel.SetActive(true);

            Debug.Log("Printing the location of the SCORE 1 PANEL: X = " + score1Panel.transform.position.x + " Y = " + score1Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 2 PANEL: X = " + score2Panel.transform.position.x + " Y = " + score2Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 3 PANEL: X = " + score3Panel.transform.position.x + " Y = " + score3Panel.transform.position.y);
            Debug.Log("Printing the location of the SCORE 4 PANEL: X = " + score4Panel.transform.position.x + " Y = " + score4Panel.transform.position.y);

            score1Pos.Set(-7, 7, 0);
            score2Pos.Set(-2, 7, 0);
            score3Pos.Set(2, 7, 0);
            score4Pos.Set(7, 7, 0);

            score1Panel.transform.position = score1Pos;
            score2Panel.transform.position = score2Pos;
            score3Panel.transform.position = score3Pos;
            score4Panel.transform.position = score4Pos;
        }
    }
Пример #34
0
 void Start()
 {
     menuObject = GameObject.FindGameObjectWithTag ("Menus");
     menu = menuObject.GetComponent<GameOverScript> ();
     gameUI = menuObject.GetComponent<GameUI>();
 }
Пример #35
0
 void Start()
 {
     gameOver = GameObject.Find("GameController").GetComponent<GameOverScript>();
 }
Пример #36
0
 void Start()
 {
     spawnTimer = Random.Range(1.0f, 1.1f);
     gameOver = GameObject.Find("GameController").GetComponent<GameOverScript>();
 }
Пример #37
0
    void Start()
    {
        menuObject = GameObject.FindGameObjectWithTag ("Menus");
        menu = menuObject.GetComponent<GameOverScript> ();
        gameUI = menuObject.GetComponent<GameUI>();

        networking = GameObject.FindGameObjectWithTag("Networking");
        clientManager = networking.GetComponent<ClientScript>();

        spawner = GameObject.FindGameObjectWithTag("Spawner");
        playerSpawner = spawner.GetComponent<PlayerSpawner>();

        currentPosition = transform.position;
    }
Пример #38
0
 void Start()
 {
     m_Animator = transform.GetChild(0).GetComponent <Animator>();
     IsEnteringScene(true);
     m_GameOverScript = GameManager.instance.ReturnGameOverScript();
 }