Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update() {
- if (GameObject.FindWithTag("MainCamera") != null) {
- player = GameObject.FindWithTag("MainCamera");
- } else {
- return;
- }
- if (!animation.IsPlaying(walkAnim) && !animation.IsPlaying(idleAnim))
- animation.Play(idleAnim);
- if (Vector3.Distance(player.transform.position, this.transform.position) < 6) {
- if (attackTimer < Time.time) {
- player.transform.GetComponent<PhotonView>().RPC("ApplyDamage", PhotonTargets.All, 35);
- attackTimer = Time.time + 2;
- }
- }
- if (Vector3.Distance(player.transform.position, this.transform.position) < 30) {
- transform.LookAt(player.transform.position);
- transform.position += transform.forward * 3.0f * Time.deltaTime;
- //transform.Translate(0.8f * Vector3.forward * Time.deltaTime);
- transform.GetComponent<PhotonView>().RPC("PlayWalkAnimation", PhotonTargets.All);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement