//Jimmy Vegas Unity Tutorial //This script is for the early AI using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoldierAI : MonoBehaviour { public string hitTag; public bool lookingAtPlayer = false; public GameObject theSoldier; void Update () { RaycastHit Hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out Hit)) { hitTag = Hit.transform.tag; } if (hitTag == "Player") { theSoldier.GetComponent().Play("FirePistol"); lookingAtPlayer = true; } else { theSoldier.GetComponent().Play("Idle"); lookingAtPlayer = false; } } }