// Start is called before the first frame update void Start() { thisSource = this.GetComponent <AudioSource>(); thisAI = this.GetComponent <Deer_AI>(); EnviromentalSource = GameObject.Find("EnviromentalSound").GetComponent <AudioSource>(); startVol = EnviromentalSource.volume; }
private void OnTriggerEnter(Collider other) { Debug.Log(other.gameObject.name); if (other.gameObject.tag == "Stag") { DeerAI = other.gameObject.GetComponent <Deer_AI>(); if (!DeerAI.alreadylooking) { DeerAI.alreadylooking = true; DeerAI.currentState = Deer_AI.AIStates.Alert; DeerAI.DeerMaxVision = 20f; DeerAI.actionTimer = Random.Range(5, 10); DeerAI.switchActions = false; DeerAI.SwitchAnimationState(Deer_AI.AIStates.Alert); } } }
void Awake() { DeerAI = Deer.GetComponent <Deer_AI>(); }