override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { game = GameObject.Find("WTHGameManger").GetComponent <WhatTheHillGame>(); player = animator.gameObject; playerController = animator.GetComponentInParent <MinifigControllerWTH>(); targetPlayer = playerInRange(player.transform.position); if (targetPlayer == null) { animator.SetBool("PlayerInSight", false); } }
// 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) { playerController = animator.GetComponentInParent <MinifigControllerWTH>(); player = animator.gameObject; this.animator = animator; game = GameObject.Find("WTHGameManger").GetComponent <WhatTheHillGame>(); pickUpContainer = GameObject.Find("PowerUpSpawner"); ringMoveArrows = GameObject.Find("RingMoveArrows"); foreach (Transform arrow in ringMoveArrows.transform) { goals.Add(arrow.position); } }
// 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) { playerController = animator.GetComponentInParent <MinifigControllerWTH>(); player = animator.gameObject; this.animator = animator; game = GameObject.Find("WTHGameManger").GetComponent <WhatTheHillGame>(); pickUpContainer = GameObject.Find("PowerUpSpawner"); Vector3 targetPosition = new Vector3(0, 0, 0); currentPath = new NavMeshPath(); NavMesh.CalculatePath(player.transform.position, targetPosition, NavMesh.AllAreas, currentPath); for (int i = 0; i < currentPath.corners.Length - 1; i++) { Debug.DrawLine(currentPath.corners[i], currentPath.corners[i + 1], Color.red); } }