public void UpdatePatrolPathWalk() { var cong = new PatrolWalkConfig { path = path, trans = transform, circular = circular, forward = forward, nearDistance = nearDistance, startIndex = startIndex }; patrolWalk = new PatrolWalk(cong); }
public PatrolWalk(PatrolWalkConfig c) { if (c.trans == null && c.IsNear == null) { Debug.LogError("Patrol walk needs transform or IsNear function"); } last = c.path.waypoints.Length - 1; startIndex = Mathf.Clamp(c.startIndex, 0, last); IsNear = c.IsNear ?? DefaultIsNear; wayIndex = startIndex; path = c.path; trans = c.trans; nearDistance = c.nearDistance; circular = c.circular; forward = c.forward; }