Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void UpdateFleeState()
- {
- //Set the target position as the player position
- destPos = playerTransform.position;
- //Check the distance with the player tank
- float dist = Vector3.Distance(transform.position, playerTransform.position);
- if (dist <= 200.0f && health <= 200)
- {
- Quaternion targetRotation = Quaternion.LookRotation(destPos - transform.position);
- transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * curRotSpeed);
- //Go Forward
- transform.Translate(Vector3.forward * Time.deltaTime * curSpeed);
- }
- curState = FSMState.Patrol;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement