// Use this for initialization void Start() { look = GetComponent <LookAt> (); character = GameObject.FindGameObjectsWithTag("Player") [0]; alertImage.rectTransform.anchoredPosition = new Vector2(0, -1); downWScript = gameObject.GetComponent <NpcDownW> (); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { roundRotation = animator.gameObject.transform.eulerAngles; roundRotation.x = Mathf.Round(roundRotation.x / 90) * 90; roundRotation.y = Mathf.Round(roundRotation.y / 90) * 90; roundRotation.z = Mathf.Round(roundRotation.z / 90) * 90; animator.gameObject.transform.eulerAngles = roundRotation; npcControl = animator.gameObject.GetComponent <NpcDownW> (); characterTrans = animator.gameObject.GetComponent <Transform> (); alertLevel = animator.gameObject.GetComponent <NPCradar> (); animator.applyRootMotion = false; wDirection = false; if (animator.gameObject.transform.position.x > 3.0f) { wDirection = true; } npcControl.isWalking = true; }