Inheritance: MonoBehaviour
コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     GameManager     = GameObject.Find("Scripts").GetComponent <GameManager>();
     ScoreController = GameObject.Find("PlayerDetails").GetComponent <HighScoreScript>();
     timerText       = GameObject.Find("Time").GetComponent <Text>();
     StartCoroutine(timer());
 }
コード例 #2
0
    // Use this for initialization
    void Awake()
    {
        blockGrid      = new GameObject[towerWidth, towerHeight];
        currentHeights = new int[6] {
            0, 0, 0, 0, 0, 0
        };
        audioManager = new GameObject().AddComponent <AudioScript>();

        Camera.main.transform.position = new Vector3(2.5f, 7f, -10f);
        Camera.main.orthographic       = true;
        Camera.main.orthographicSize   = 7.5f;

        highScoreManager = gameObject.AddComponent <HighScoreScript>();

        initializeBlockWell();

        initializeBlockPair();

        initializeDestroyBlock();

        initializeScoreText();

        initializeAlertText();

        flashPermanentAlert("Press ENTER to begin.");

        debugPointsPerLevel = new int[100];
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     nameInputField   = GameObject.Find("NText");
     registerButton   = GameObject.Find("StrtButton");
     score_controller = GameObject.Find("PlayerDetails").GetComponent <HighScoreScript>();
     registerButton.GetComponent <Button>().onClick.AddListener(registerButtonPressed);
 }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        GameManager      = GameObject.Find("Scripts").GetComponent <GameManager>();
        pastPositions    = new List <Vector3>();
        score_controller = GameObject.Find("PlayerDetails").GetComponent <HighScoreScript>();
        TimeManager      = GameObject.Find("Canvas").GetComponent <TimeScript>();

        if (SceneManager.GetActiveScene().name == "Lvl2")
        {
            snakeLength = 5;
        }

        if (SceneManager.GetActiveScene().name == "Lvl3")
        {
            snakeLength = 1;
        }

        for (int i = 0; i < snakeLength; i++)
        {
            GameObject g = Instantiate(tailPrefab, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y + (i + 1), 0f), Quaternion.identity);

            // Keep track of it in our tail list
            tailPositions.Insert(tailPositions.Count, g.transform);
        }
    }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     scoreText        = GameObject.Find("Score").GetComponent <Text>();
     score_controller = GameObject.Find("PlayerDetails").GetComponent <HighScoreScript>();
     playerHead       = Resources.Load <GameObject>("Prefabs/PlayerSnake");
     foodPrefab       = Resources.Load <GameObject>("Prefabs/Food");
     enemyPrefab      = Resources.Load <GameObject>("Prefabs/EnemySnake");
     SpawnPlayer();
 }
コード例 #6
0
    private void Awake()
    {
        inctance = this;

        if (PlayerPrefs.HasKey("SaveScore"))
        {
            highScoreCounter = PlayerPrefs.GetInt("SaveScore");
        }
    }
コード例 #7
0
 void Start()
 {
     //playerOrder = 0;
     playerName       = PlayerPrefs.GetString("PlayerID");
     highscoreManager = GetComponent <HighScoreScript>();
     for (int i = 0; i < highscoreText.Length; i++)
     {
         highscoreText[i].text = i + 1 + ".Fetching...";
     }
     StartCoroutine(RefreshHighScores());
 }
コード例 #8
0
 // Start is called before the first frame update
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #9
0
    void Awake()
    {
        DontDestroyOnLoad(this);

        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
コード例 #10
0
    public void ShowScreenOnly(string screenName)
    {
        StartCoroutine(fadeAwayScript.FadeAway());

        foreach (var item in screensList)
        {
            GameObject screen = item.Value;
            screen.SetActive((item.Key == screenName));
        }

        if (screenName == "HighScore" || screenName == "GameOver")
        {
            HighScoreScript highScore = screensList[screenName].GetComponentInChildren <HighScoreScript>();
            highScore.DisplayScores();
        }
    }
コード例 #11
0
 private void voiceEvaluateObj(bool boolean)
 {
     if (boolean)
     {
         //Debug.Log("You're correct");
         winPanel.SetActive(true);
         PlayerPrefs.SetInt("TmpScore", (PlayerPrefs.GetInt("TmpScore", 00) + 2));
         score.text = PlayerPrefs.GetInt("TmpScore", 00).ToString();
         Start();
     }
     else
     {
         //Debug.Log("Wrong Answer");
         failPanel.SetActive(true);
         HighScoreScript.insertScore(PlayerPrefs.GetInt("TmpScore"));
     }
 }
コード例 #12
0
ファイル: LevelViewScript.cs プロジェクト: zerojjm/CarSlalom
	// Use this for initialization
	void Start () {
		lblStyle.fontSize = 24;
		lblStyle.alignment = TextAnchor.MiddleCenter;
		HighScoreScript hsScript = (HighScoreScript) gameObject.GetComponent(typeof(HighScoreScript));
		//hsScript.Save(); // This will reset highscores
		hsScript.Load();

		highScore1 = hsScript.highScores.highscore1;
		highScore2 = hsScript.highScores.highscore2;
		highScore3 = hsScript.highScores.highscore3;
		highScore4 = hsScript.highScores.highscore4;
		highScore5 = hsScript.highScores.highscore5;

		scrollStarted = false;
		scrollXValue = 0;
		AdHandlerScript.showBanner();
	}
コード例 #13
0
 void Start()
 {
     //degisim
     highScoreScript   = GameObject.Find("HighScoreObject").GetComponent <HighScoreScript>();
     instantiateObject = GameObject.Find("InstantiateEnemy");
     playerObject      = GameObject.FindGameObjectWithTag("Player");
     kingScript        = playerObject.GetComponent <RedKing>();
     adPanel           = GameObject.Find("adPanel");
     adScript          = GameObject.Find("adManagerObject").GetComponent <MobadScript>();
     adPanel.SetActive(false);
     isAdStateFinished  = false;
     isPlayerMadeChoice = false;
     panelActivated     = false;
     isItTimeToGo       = false;
     isCountUpdated     = false;
     adCount            = PlayerPrefs.GetInt("PlayerDontWatchTheAds");
 }
コード例 #14
0
 private void evaluateObj(Sprite sprite)
 {
     if (GetComponent <Image>().sprite == sprite)
     {
         //Debug.Log("You're correct");
         winPanel.SetActive(true);
         PlayerPrefs.SetInt("TmpScore", (PlayerPrefs.GetInt("TmpScore", 00) + 2));
         score.text = PlayerPrefs.GetInt("TmpScore", 00).ToString();
         Start();
     }
     else
     {
         //Debug.Log("Wrong Answer");
         failPanel.SetActive(true);
         HighScoreScript.insertScore(PlayerPrefs.GetInt("TmpScore"));
     }
 }
コード例 #15
0
    void Start()
    {
        Debug.Log("Victors pik er f*****g lille");
        Debug.Log("hahahahha");
        BPM = GameManager.GetComponent <ButtonPressManager>();
        HSS = GameManager.GetComponent <HighScoreScript>();


        if (YoungFile != null)
        {
            YoungLines = (YoungFile.text.Split('\n'));
        }

        if (MiddleFile != null)
        {
            MiddleLines = (MiddleFile.text.Split('\n'));
        }

        if (OldFile != null)
        {
            OldLines = (OldFile.text.Split('\n'));
        }

        if (YoungEndAtLine == 0)
        {
            YoungEndAtLine = YoungLines.Length - 1;
        }

        if (MiddleEndAtLine == 0)
        {
            MiddleEndAtLine = MiddleLines.Length - 1;
        }

        if (OldEndAtLine == 0)
        {
            OldEndAtLine = OldLines.Length - 1;
        }

        //if (isActive)
        //{
        //    EnableTextBox();
        //}
    }
コード例 #16
0
	// Use this for initialization
	void Start () {
	
		/*GameObject carObject = GameObject.Find ("Player");
		if (carObject != null) 
		{
			SpriteRenderer carSprite = carObject.GetComponent<SpriteRenderer>();
			if(carSprite != null)
			{
				if(SelectedLevelScript.selectedCar == 1)
					carSprite.sprite = Resources.Load<UnityEngine.Sprite>("car2");
				else if(SelectedLevelScript.selectedCar == 2)
					carSprite.sprite = Resources.Load<UnityEngine.Sprite>("rallycar");
			}
		}*/
		HighScoreScript hsScript = (HighScoreScript) gameObject.GetComponent(typeof(HighScoreScript));
		//hsScript.Save(); // This will reset highscores
		hsScript.Load();
		obstacleIndex = 0;
		obstacleCount = 0;
		iteration = 0;
		startTimer = 0;
		videoAdToBeShown = false;
		interstitialToBeShown = false;
		float screenAspect = (float)Screen.width / (float)Screen.height;
		float cameraHeight = Camera.main.orthographicSize * 2;
		stage_bounds = new Bounds(
			Camera.main.transform.position,
			new Vector3(cameraHeight * screenAspect, cameraHeight, 0));


		CreateObstacles ();

		showingNumber = 4;

		easyPort = true;
		prevObstacle = 0;

	}
コード例 #17
0
ファイル: GameManagerScript.cs プロジェクト: Flopmind/GDD2
    // Update is called once per frame
    async void Update()
    {
        if (player)
        {
            score = player.GetComponent <PlayerScript>().Score();
        }

        timer += Time.deltaTime;
        if (timer >= interval)
        {
            currentBudget = budget;
            timer        -= interval;
            GameObject nextHazard;
            int        price;
            int        count1 = 0;
            int        count2 = 0;
            do
            {
                count1++;
                int oldBudget = currentBudget;
                do
                {
                    count2++;
                    nextHazard = hazardPrefabs[Random.Range(0, hazardPrefabs.Length)];
                    if (!laserUsed && nextHazard == hazardPrefabs[3])
                    {
                        laserUsed = true;
                    }
                    else if (nextHazard == hazardPrefabs[3])
                    {
                        do
                        {
                            nextHazard = hazardPrefabs[Random.Range(0, hazardPrefabs.Length)];
                        }while (nextHazard == hazardPrefabs[3]);
                    }
                    price          = nextHazard.GetComponent <Hazard>().Spend(currentBudget);
                    currentBudget -= price;
                }while (oldBudget == currentBudget);
                Vector3    nextHazardPosition;
                Quaternion nextHazardRotation;

                if (odd)
                {
                    nextHazardPosition = nextHazard.GetComponent <Hazard>().GetImplementLoc1();
                    nextHazardRotation = nextHazard.GetComponent <Hazard>().GetImplementRot1();
                }
                else
                {
                    nextHazardPosition = nextHazard.GetComponent <Hazard>().GetImplementLoc2();
                    nextHazardRotation = nextHazard.GetComponent <Hazard>().GetImplementRot2();
                }
                odd = !odd;

                GameObject haz = Instantiate(nextHazard, nextHazardPosition, nextHazardRotation);
                haz.GetComponent <Hazard>().ApplySpend(price);
            }while (currentBudget > lowestCost);
            laserUsed = false;
            budget   += budgetIncrement;
        }

        if (submit)
        {
            submit = false; // never submit again
            // Upload the high score
            await HighScoreScript.UploadHighScore(playersName, (int)score);

            // Get high score display
            highScoreList = await HighScoreScript.GetHighScores();

            // Set as submitted
            submitted = true;
        }
    }
コード例 #18
0
 void Awake()
 {
     HighScoreRef = GetComponent<HighScoreScript>();
 }
コード例 #19
0
 void Awake()
 {
     highScore   = transform.parent.GetComponentInChildren <HighScoreScript>();
     infoDisplay = GetComponent <InfoDisplayScript>();
 }
コード例 #20
0
ファイル: MainMenu.cs プロジェクト: avcjeewantha/Bring-Go
 public void showHighScore()               //executes the update method in HighScoreScript
 {
     HighScoreScript.showHighScore();
 }
コード例 #21
0
	void DoGameOverWindow(int windowID) {

		if (!AdHandlerScript.bannerVisible)
		{
			AdHandlerScript.showBanner();
		}

		GUI.skin = mainSkin;
		GUI.skin.button.fontSize = 22 * Screen.height / 800;

		float btnHeight = Screen.height / 16;
		float btnWidth = Screen.width / 4;
		float lblStartY = btnHeight;
		float btnStartY = Screen.width / 2 + 1.6f*btnHeight;

		lblStyleBig.fontSize = 34 * Screen.height / 800;
		lblStyle.fontSize = 26 * Screen.height / 800;

		GUI.Label(new Rect(Screen.width / 2 -1.3f*btnWidth, Screen.height / 10, 2*btnWidth, btnHeight), "GAME OVER!", lblStyleBig);

		GUI.Label(new Rect(Screen.width / 2 -1.0f*btnWidth, Screen.height / 10+1.5f*btnHeight, 2*btnWidth, btnHeight), "SCORE: "+ CarScript.score.ToString(), lblStyle);

		HighScoreScript hsScript = (HighScoreScript) gameObject.GetComponent(typeof(HighScoreScript));

		int hsScore = 0;
		if (SelectedLevelScript.selectedLevel == 1) 
		{
			hsScore = hsScript.highScores.highscore1;
		}
		else if (SelectedLevelScript.selectedLevel == 2) 
		{
			hsScore = hsScript.highScores.highscore2;
		}
		else if (SelectedLevelScript.selectedLevel == 3) 
		{
			hsScore = hsScript.highScores.highscore3;
		}
		else if (SelectedLevelScript.selectedLevel == 4) 
		{
			hsScore = hsScript.highScores.highscore4;
		}
		else if (SelectedLevelScript.selectedLevel == 5) 
		{
			hsScore = hsScript.highScores.highscore5;
		}
		int carScore = CarScript.score;

		if (hsScore <= carScore) 
		{
			GUI.Label (new Rect (Screen.width / 2 - 1.5f * btnWidth, Screen.height / 10 + 3f * btnHeight, btnWidth*5, btnHeight), "THAT'S A HIGHSCORE!", lblStyle);

			if (SelectedLevelScript.selectedLevel == 1) 
			{
				hsScript.highScores.highscore1 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 2) 
			{
				hsScript.highScores.highscore2 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 3) 
			{
				hsScript.highScores.highscore3 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 4) 
			{
				hsScript.highScores.highscore4 = carScore;
			}
			else if (SelectedLevelScript.selectedLevel == 5) 
			{
				hsScript.highScores.highscore5 = carScore;
			}
			hsScript.Save();
		}

		if (GUI.Button(new Rect(Screen.width / 2 -btnWidth, btnStartY, btnWidth, 1.2f*btnHeight), " RESTART"))
			Application.LoadLevel("GameScene");

		if (GUI.Button(new Rect(Screen.width / 2 -btnWidth, btnStartY+2*btnHeight, btnWidth, 1.2f*btnHeight), "  BACK"))
			Application.LoadLevel("LevelScene");

		if (videoAdToBeShown)
		{
			AdHandlerScript.showVideoAd();
			videoAdToBeShown = false;
		}
		if (interstitialToBeShown)
		{
			AdHandlerScript.showInterstitial();
			interstitialToBeShown = false;
		}
	}