Advertisement
diliupg

MossGiant

Jan 10th, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class MossGiant : Enemy // inherits from the Main Enemy Class
  6. {
  7.  
  8.     // Use this for initialization
  9.     private void Start()
  10.     {
  11.  
  12.     }
  13.  
  14.     // Update is called once per frame
  15.     public override void Update()
  16.     {
  17.  
  18.         if(transform.position == pointA.position)
  19.         {
  20.             print("pointA");
  21.             transform.position = Vector3.MoveTowards(transform.position, pointB.position, speed * Time.deltaTime);
  22.         }
  23.  
  24.         else if(transform.position == pointB.position)
  25.         {
  26.             print("pointB");
  27.             transform.position = Vector3.MoveTowards(transform.position, pointA.position, speed * Time.deltaTime);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement