// Update is called once per frame void Update() { transform.position = Vector3.Lerp(transform.position, dest, 2f * Time.deltaTime); if ((transform.position - dest).magnitude < 0.3f) { start_space.get_connections(); } }
void find_desired_move() { space[] avail = current_space.get_connections(); List <space> valid = new List <space>(); foreach (space s in avail) { if (s != null && !s.broken && !s.is_obstacle) { valid.Add(s); } } if (valid.Count > 0) { next_space = valid[(int)Random.Range(0, valid.Count)]; move(); } }