// Use this for initialization void Start() { GS = GameObject.FindGameObjectWithTag("GameState"); GSscript = GS.GetComponent <GameState> (); TrapBubble = GetComponentInChildren <TrapBubbleScript> (); VisionSphere = GetComponent <SphereCollider> (); anim = GetComponent <Animator> (); anim.SetBool("Moving", true); Player = GameObject.FindGameObjectWithTag("Player"); PlayerCon = Player.GetComponent <PlayerController> (); PlayerTransform = Player.GetComponent <Transform> (); ratController = GetComponent <CharacterController>(); nav = GetComponent <NavMeshAgent> (); nav.updatePosition = true; //use nav map for rotation, should be changed to use an animator at somepoint nav.updateRotation = true; nav.angularSpeed = 100; alive = true; ratWaypoint = GameObject.FindGameObjectsWithTag("Lamps"); ratWaypointIndex = Random.Range(0, ratWaypoint.Length); fleeLocation = this.transform.position; lightComp = ratWaypoint [ratWaypointIndex].GetComponentInChildren <Light> (); state = RatAI.State.WONDER; StartCoroutine("FSM"); }
// Use this for initialization void Start() { GS = GameObject.FindGameObjectWithTag ("GameState"); GSscript = GS.GetComponent<GameState> (); TrapBubble = GetComponentInChildren<TrapBubbleScript> (); VisionSphere = GetComponent<SphereCollider> (); anim = GetComponent<Animator> (); anim.SetBool ("Moving", true); Player = GameObject.FindGameObjectWithTag ("Player"); PlayerCon = Player.GetComponent<PlayerController> (); PlayerTransform = Player.GetComponent<Transform> (); ratController = GetComponent<CharacterController>(); nav = GetComponent<NavMeshAgent> (); nav.updatePosition = true; //use nav map for rotation, should be changed to use an animator at somepoint nav.updateRotation = true; nav.angularSpeed = 100; alive = true; ratWaypoint = GameObject.FindGameObjectsWithTag ("Lamps"); ratWaypointIndex = Random.Range (0, ratWaypoint.Length); fleeLocation = this.transform.position; lightComp = ratWaypoint [ratWaypointIndex].GetComponentInChildren<Light> (); state = RatAI.State.WONDER; StartCoroutine ("FSM"); }