void Update() { if (obj.transform.position == target) { GameSceneController.GetInstance().setMoving(false); if (monitor != null) { monitor.OnActionCompleted(this); } Destroy(this); } }
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); } }