protected virtual void Start() { try { CurrentAttackableObjects currentAttackableObjects = GameObject.FindWithTag("GameManager").GetComponent <CurrentAttackableObjects>(); vegetableList = currentAttackableObjects.vegetableList; animalList = currentAttackableObjects.animalList; } catch { throw new System.ArgumentException("Couldn't find Vegetable List or Animal List. Make sure there exists a Game Object with the game object tag and a current attackable objects script is a component of the game manager"); } try { roundManager = GameObject.FindWithTag("RoundManager").GetComponent <RoundManager>(); } catch { throw new System.ArgumentException("Couldn't find round manager script. Make sure there is a round manager object with the proper tag and this object has a round manager script"); } if (gameObject.tag != "Barn") { aIAudioPlayer = gameObject.GetComponent <Audio.AIAudioPlayer>(); if (aIAudioPlayer == null) { throw new System.ArgumentException("Could not find audio player attached to " + name); } } }
private void Start() { ChangeState(new SearchState(this)); currentTarget = null; aIAudioPlayer = gameObject.GetComponent <Audio.AIAudioPlayer>(); if (aIAudioPlayer == null) { throw new System.ArgumentException("Could not find audio player attached to " + name); } StartCoroutine(SpawnSoundCoroutine()); }