private void UpdateAndContinue(string goalScore, bool isOutOfBounds) { if (!isOutOfBounds) { KeepScore.IncreaseTextUIScore(goalScore); } switch (Direction.x > 0) { case true: // This one is especially important for AI in order to not get scored on repeatedly Direction = Vector2.right.normalized; break; default: // Makes the ball go horizontally straight after scoring (in this case to the left) Direction = Vector2.left.normalized; break; } // Reset ball position transform.position = new Vector2(0, 0); // Staart the countdown StartCoroutine(score.Countdown()); }
private static void PlaySound(string soundName) { var audioSource = KeepScore.GetInstance().GetComponent <AudioSource>(); audioSource.clip = Resources.Load <AudioClip>(soundName); audioSource.Play(); }
// Start is called before the first frame update void Start() { gm = GameObject.FindGameObjectWithTag("scoremem").GetComponent <KeepScore>(); score.text = "" + gm.score; retry.onClick.AddListener(() => reloadGame()); quit.onClick.AddListener(() => quitGame()); }
// Update is called once per frame void Update() { if (KeepScore.IsHighScore()) { textDisplay.GetComponent <Text>().text = "You have acheived a new high score, enter initials: "; } }
public void EndGame() { GameTime -= Time.deltaTime; T = GameTime; readval = Player.GetComponent <KeepScore>(); score = readval.Points; Score.text = GameTime.ToString("0"); if (GameTime < 0 && ended == false) { if (PlayerPrefs.GetInt("HighScore") < score) { PlayerPrefs.SetInt("HighScore", score); } Score.text = "GAME OVER: Score " + score.ToString(); ended = true; FindObjectOfType <PlayerBehaviour>().enabled = false; FindObjectOfType <MobileMovement>().enabled = false; FindObjectOfType <CoinMovement>().enabled = false; FindObjectOfType <KeepScore>().enabled = false; FindObjectOfType <TextDisplay>().enabled = false; FindObjectOfType <TextDisplay>().enabled = false; initscore.GetComponent <Text>().enabled = false; FindObjectOfType <CameraMovement>().enabled = false; Invoke("Pause", delay); } }
public void TotalScore() { // get the text object Text text = totalScoreText.GetComponent <Text> (); // get the players end score GameObject scoreText = GameObject.Find("ScoreText"); KeepScore script = scoreText.GetComponent <KeepScore> (); totalScore = script.ScoreVal; text.text = "Total Score: " + script.ScoreVal; // unlock ship 2 if (script.ScoreVal >= 10000) { GameObject GameControl = GameObject.Find("GameController"); GameControl gameScript = GameControl.GetComponent <GameControl> (); if (gameScript.unlockedShips[1] == true) { Debug.Log("Ship 2 already unlocked"); } else if (gameScript.unlockedShips[1] == false) { GameObject canvasManager = GameObject.Find("CanvasManager"); ToggleNewShipCanvas NSCS = canvasManager.GetComponent <ToggleNewShipCanvas> (); NSCS.newShip = true; Debug.Log("UNLOCK SHIP 2"); } gameScript.unlockedShips[1] = true; } }
void Start () { player = GameObject.Find("player"); bonusLifecycle = GameObject.Find("ObstacleManager").GetComponent<BonusLifecycle>(); score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); minSpeed += Random.Range(-0.015f, 0.005f); maxSpeed += Random.Range(-0.08f, 0.01f); }
void ResetScore() { // reset the score GameObject scoreText = GameObject.Find("ScoreText"); KeepScore scoreScript = scoreText.GetComponent <KeepScore>(); scoreScript.Rest_Score(); }
void Start () { score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); audioSource.clip = geigerSounds[Random.Range(0, geigerSounds.Length)]; audioSource.Play(); }
// Start is called before the first frame update void Start() { blueText.text = "Blue Points: 0"; redText.text = "Red Points: 0"; scoreable = true; keepScore = FindObjectOfType <KeepScore>(); playPS = FindObjectOfType <PlayParticleSystem>(); }
void AddToScore() { // add to score GameObject scoreText = GameObject.Find("ScoreText"); KeepScore scoreScript = scoreText.GetComponent <KeepScore>(); scoreScript.AddScore(GetPoints()); }
public static void minusKills() { Lives -= 1; KeepScore textChanger = KeepScore.GetInstance(); textChanger.ChangeText(); PlaySound(LOSER_SOUND); }
// Use this for initialization void Start() { Direction = new Vector2(); rigidBody = GetComponent <Rigidbody2D>(); rigidBody.velocity = Vector2.right * speed; score = GameObject.Find("ScoreTimeCanvas").GetComponent <KeepScore>(); topWallY = GameObject.Find("Top Wall").transform.position.y; bottomWallY = GameObject.Find("Bottom Wall").transform.position.y; }
public static void addScore() { Score += 1; KeepScore textChanger = KeepScore.GetInstance(); textChanger.ChangeText(); PlaySound(VICTORY_SOUND); }
void Start () { score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); wipeoutDisplay = (UpdateWipeoutDisplay)GameObject.Find("WipeoutDisplay").GetComponent(typeof(UpdateWipeoutDisplay)); // numWipeouts = startingWipeouts; currentTraps = new ArrayList(); currentBonuses = new ArrayList(); for(int i = 0; i < numStartingBonuses; i++){ PlaceBonus(); } }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }
// Start is called before the first frame update void Start() { //may need to change this once we put in more than one particle system in the scene //playPS = FindObjectOfType<PlayParticleSystem>(); keepScore = FindObjectOfType <KeepScore>(); herdAgent = FindObjectOfType <HerdAgent>(); mediumMaturity = herdAgent.mediumMaturity; fullMaturity = herdAgent.fullMaturity; red = redScore.GetComponent <Animator>(); blue = blueScore.GetComponent <Animator>(); soundMidPlay = FMODUnity.RuntimeManager.CreateInstance(soundMid); soundFullPlay = FMODUnity.RuntimeManager.CreateInstance(soundFull); }
void Start () { manager = (ManageTutorial)GameObject.Find("TutorialManager").GetComponent(typeof(ManageTutorial)); bl = (BonusLifecycle)GameObject.Find("ObstacleManager").GetComponent(typeof(BonusLifecycle)); score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); if(isCollectionTarget || isTimed){ GetComponent<Collider2D>().enabled = false; } if(ObjectsToAdd.Length > 0){ for(int i = 0; i< ObjectsToAdd.Length; i++){ ObjectsToAdd[i].SetActive(false); } } }
void OnCollisionEnter(Collision col) { collidedWith = col.gameObject; if (collidedWith.GetComponent <AudioSource>() != null && collidedWith.GetComponent <AudioSource>().isPlaying == true) { Destroy(collidedWith); KeepScore.addScore(); CreateNewCube(); } else { KeepScore.minusKills(); } }
void OnTriggerExit2D(Collider2D other) { SpriteRenderer renderer = GetComponent <SpriteRenderer>(); KeepScore scoreKeeper = mainGame.GetComponent <KeepScore> (); if (correctKeyPressed == true) { renderer.sprite = sheepGreen; scoreKeeper.increaseScore(); } else { renderer.sprite = sheepRed; scoreKeeper.decreaseScore(); } }
void Start() { foreach (Image x in hillTimers) { x.color = new Color(255, 255, 255, 0f); } parameterSetByName = GameObject.FindObjectOfType <ParameterSetByName>(); DontDestroyOnLoad(this); keepScore = FindObjectOfType <KeepScore>(); Debug.Log(keepScore); winner = "hi"; hillCollection = hills.GetComponentsInChildren <Transform>(); timePassed_seconds = 1.0f; hillCollection = ConstructHillArray(hillCollection); foreach (Transform element in hillCollection) { element.gameObject.SetActive(false); } index = Random.Range(0, hillCollection.Length); activeHill = hillCollection[index]; activeHill.gameObject.SetActive(true); activatedHills.Add(index); changeTimerColor(activeHill); crystalSpawners = GameObject.FindGameObjectsWithTag("crystalSpawner"); desertSpawners = GameObject.FindGameObjectsWithTag("desertSpawner"); tropicalSpawners = GameObject.FindGameObjectsWithTag("tropicalSpawner"); bisonSpawn = crystalSpawners[0].GetComponent <BisonSpawn>(); int totalBison = bisonCount * 2 * (crystalSpawners.Length + desertSpawners.Length + tropicalSpawners.Length); bisonNames = new string[totalBison]; bisonNames = GenerateNames(totalBison); for (int k = 0; k < bisonNames.Length; k++) { //Debug.Log("bisonNames: " + bisonNames[k]); //Debug.Log("bisonNames: " + bisonNames[k]); } determineSpawnLocation(bisonCount, 0); parameterSetByName.TimeGet(gameTime_seconds, activeHill); refreshed = false; // Start time marker timeMarker.GetComponent <Transform>().DOLocalRotate(new Vector3(0f, 0f, 0f), 360f, RotateMode.Fast).SetEase(Ease.Linear); }
public void GetRank() { // get saved data GameObject gameControl = GameObject.Find("GameController"); GameControl gameScript = gameControl.GetComponent <GameControl> (); // get score value KeepScore scoreScript = scoreText.GetComponent <KeepScore>(); // for each one post the score for (int i = 0; i <= 4; i++) { if (highScore == false) { if (gameScript.scores[i] < scoreScript.ScoreVal) { Rank = i + 1; highScore = true; } } } }
// Update is called once per frame void Update() { if (int.Parse(pourcentile.pourcentageTxt.text.Substring(0, pourcentile.pourcentageTxt.text.Length - 1)) <= 0) { gameOver_Sound.Play(); objG.gravity = 5; if (spotlight.range > 0) { spotlight.range -= 0.1f; } cnv.enabled = true; if (endGame) { score.text = "Score: " + levelTxtBox.text; KeepScore.WriteHighScore(int.Parse(levelTxtBox.text)); //Checker si new highscoer avec le fichier text highscore.text = "Top score: " + KeepScore.ReadHighScore(); endGame = false; } } }
private void Start() { //find object of type is not a perfect solution, but since it's the only object of this type in scene and it goes through different scenes, it's the simplest one keep = FindObjectOfType <KeepScore>(); PutUIScore(); }
// Use this for initialization void Start () { score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); animator.StopPlayback(); }
void Update() { readval = Player.GetComponent <KeepScore>(); score = readval.Points; Score.text = score.ToString(); }
void Start () { score = (KeepScore)GameObject.Find("progress_bar").GetComponent(typeof(KeepScore)); }
void Awake() { Instance = this; }