private void Start() { cameraAnim = Camera.main.GetComponent <Animator>(); anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); transition = FindObjectOfType <sceneTransition>(); }
// Use this for initialization void Start() { background = GameObject.Find("MessageBackground").GetComponent <Image>(); audioPlayer = GetComponent <AudioSource>(); sceneChanger = GetComponent <sceneTransition>(); winMessage = GameObject.Find("DeathMessage").GetComponent <Text>(); if (sceneChanger.IsPlayScene()) { FindObjectOfType <ScoreCounter>().ResetScore(); Debug.Log("counting pigs and resetting scene scores"); listOfEnemies = FindObjectsOfType <EnemySpawner>(); CountEnemies(listOfEnemies); //FindObjectOfType<ScoreCounter>().ResetScore(); } if (sceneChanger.GetCurrentScene() == 2) { FindObjectOfType <ScoreCounter>().ResetTotalScore(); } if (sceneChanger.IsGameOver()) { Debug.Log("This should print in last scenes"); FinalResult(); } }
private void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player2").transform; sceneTransitions = FindObjectOfType <sceneTransition>(); }
private void Start() { halfHealth = health / 2; anim = GetComponent <Animator>(); healthBar = FindObjectOfType <Slider>(); healthBar.maxValue = health; healthBar.value = health; transition = FindObjectOfType <sceneTransition>(); }
// Use this for initialization void Start() { audioPlayer = GetComponent <AudioSource>(); sceneChanger = GetComponent <sceneTransition>(); currentSceneIndex = sceneChanger.GetCurrentScene(); if (currentSceneIndex == 0) { StartCoroutine(LoadFromSplashWithDelay()); } }