
- create a variable for Player
- in Update() method,
- make Spider keep looking at Player by using transform.Lookat()


- create variables for
- Player
- distance obtained by RayCasting
- distance where Enemy starts to move towards Player
- Spider itself
- speed of Spider
- attack trigger to indicate when spider starts to attack
- for RayCasting
- in Update() method,
- put the information from RayCasting to the RayCastingHit variable
- put the distance from RayCasting into the variable for distance
- if Player is within the minimum range of Spider,
- set the speed of Spider
- if attackTrigger is 0,
-
- make Spider move with the animation, “walk”, toward Player by setting its tranform
- if Player has left from the range of Spider,
- set the speed of Spider into 0
- make Spider idlen with the animation, “idle”



- in Update() method,
- add another if statement,
-
- if attackTrigger is 1
-
-
- set the speed of Spider into 0
-
-
-
- make spider attack with animation, “attack”
-
- in OntriggerEnter() method,
- when spider touches somthing(Player), set attackTrigger into 1
- in OntriggerExit() method,
- when Player has escaped Spider, set attackTrigger into 0 to make it stop attack


- add Mesh Collider to Player
- Convex, and is Trigger
































































