Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. void Update() {
  2.         if (GameObject.FindWithTag("MainCamera") != null) {
  3.             player = GameObject.FindWithTag("MainCamera");
  4.         } else {
  5.             return;
  6.         }
  7.         if (!animation.IsPlaying(walkAnim) && !animation.IsPlaying(idleAnim))
  8.             animation.Play(idleAnim);
  9.  
  10.         if (Vector3.Distance(player.transform.position, this.transform.position) < 6) {
  11.             if (attackTimer < Time.time) {
  12.                 player.transform.GetComponent<PhotonView>().RPC("ApplyDamage", PhotonTargets.All, 35);
  13.                 attackTimer = Time.time + 2;
  14.             }
  15.         }
  16.  
  17.         if (Vector3.Distance(player.transform.position, this.transform.position) < 30) {
  18.             transform.LookAt(player.transform.position);
  19.             transform.position += transform.forward * 3.0f * Time.deltaTime;
  20.             //transform.Translate(0.8f * Vector3.forward * Time.deltaTime);
  21.             transform.GetComponent<PhotonView>().RPC("PlayWalkAnimation", PhotonTargets.All);
  22.         }
  23.  
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement