// Start is called before the first frame update void Start() { // Getting all needed child objects. actionText = transform.GetChild(2).gameObject.GetComponent <TextMeshPro>(); bloodParticle = transform.GetChild(3).gameObject.GetComponent <ParticleSystem>(); shootingParticle = transform.GetChild(4).gameObject.GetComponent <ParticleSystem>(); // Getting player object. player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); audioSource = gameObject.GetComponent <AudioSource>(); shotSound = Resources.Load <AudioClip>("Sounds/gunshot_sound"); reloadSound = Resources.Load <AudioClip>("Sounds/reload_sound"); hitSound = Resources.Load <AudioClip>("Sounds/hit_sound"); emotion = gameObject.GetComponent <EmotionScript>(); shoot = false; currentCoolDown = 0.0f; }
// Start is called before the first frame update void Start() { // Getting all allied AI units. allyAgents = new List <GameObject>(); GameObject[] agents = GameObject.FindGameObjectsWithTag("Enemy"); for (int i = 0; i < agents.Length; i++) { allyAgents.Add(agents[i]); } noOfAgents = allyAgents.Count; coverFinder = gameObject.GetComponent <CoverFinderScript>(); movementScript = gameObject.GetComponent <MovementScript>(); agentScript = gameObject.GetComponent <AgentScript>(); emotion = gameObject.GetComponent <EmotionScript>(); player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); decisionTimer = 0.0f; }