// Start is called before the first frame update void Start() { if (UponDeath == null) { UponDeath = new UnityEvent(); } thing = this.gameObject; // Gets sound source GameObject source = GameObject.Find("Sound Source"); sound = source.GetComponent <SoundPlayonEvent>(); // Sets component of Player HB, and runs it for the first time GameObject play = GameObject.FindGameObjectWithTag("Player"); player = play.GetComponent <PlayerHealthBar>(); player.HealthChange(CurrentHealth, MaximumHealth); //unused bit for boss /* * Scene currentScene = SceneManager.GetActiveScene(); * // Gets script off of health bar object, and runs it once * if (currentScene.buildIndex == 6) * { * GameObject enemy = GameObject.Find("Boss Health"); * boss = enemy.GetComponent<BossHealthBar>(); * boss.BarChange(); * } */ }
// Start is called before the first frame update void Start() { // Gets sound script from sound source object GameObject source = GameObject.Find("Sound Source"); sound = source.GetComponent <SoundPlayonEvent>(); myRb = GetComponent <Rigidbody2D>(); }
void Start() { //get the sound script GameObject soundSource = GameObject.Find("Sound Source"); // Sets up sound sound = soundSource.GetComponent <SoundPlayonEvent>(); //set the invuln cooldown to 1 second cooldown = 1; }
// Start is called before the first frame update void Start() { // Sets game object of sound source to find script on it GameObject soundSource = GameObject.Find("Sound Source"); myRb = GetComponent <Rigidbody2D>(); dash.x = 12; negdash.x = -12; // Uses script from sound source object and sets it for use sound = soundSource.GetComponent <SoundPlayonEvent>(); }
//get rigidbody of player public void Start() { myRb = GetComponent <Rigidbody2D>(); // Sets game object of sound source to find script on it GameObject soundSource = GameObject.Find("Sound Source"); // Uses script from sound source object and sets it for use sound = soundSource.GetComponent <SoundPlayonEvent>(); isDead = gameObject.GetComponent <Respawn>(); //get the respawn script }