Example #1
0
 void Update()
 {
     if (obj.transform.position == target)
     {
         GameSceneController.GetInstance().setMoving(false);
         if (monitor != null)
         {
             monitor.OnActionCompleted(this);
         }
         Destroy(this);
     }
 }
Example #2
0
        void Update()
        {
            float step = speed * Time.deltaTime;

            transform.position = Vector3.MoveTowards(transform.position, target, step);
            if (transform.position == target)
            {
                GameSceneController.GetInstance().setMoving(false);
                if (monitor != null)
                {
                    monitor.OnActionCompleted(this);
                }
                Destroy(this);
            }
        }