private void Start() { if (_ballDetector == null) { _ballDetector = GetComponent <BallDetector>(); } }
void Awake() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); shootBall = GameObject.FindObjectOfType <ShootBalloon>(); ballDetector = GameObject.FindObjectOfType <BallDetector>(); attackUI = GameObject.FindObjectOfType <AttackUIActions>(); spawnManager = GameObject.FindObjectOfType <SpawnManager>(); spawnManager.GenerateRandomShootPosition(); whistleSource = GetComponent <AudioSource>(); }
private void Start() { state = DoggoState.ROAMING; audioSource = GetComponent <AudioSource>(); status = GetComponent <DogStatus>(); agent = GetComponent <NavMeshAgent>(); pb = GetComponent <PhysicsBehaviour>(); foodDetector = GetComponentInChildren <FoodDetector>(); ballDetector = GetComponentInChildren <BallDetector>(); myTransform = transform; playerTransform = FindObjectOfType <Player>().transform; animator = GetComponent <Animator>(); audioSource.Play(); spawnDespawnParticleSystem.Play(); AudioSource.PlayClipAtPoint(spawnClip, transform.position); StartCoroutine(BarkRandomly()); }